is this a bug?
yes and I think it's been reported on github somewhere and maybe there's a fix already
what you need to do is have the variable symbol alone with spaces, like
fexpr~ if((CR_$0>HT_$0), CG_$0 = $f3* CG_$0 + (1-$f3)*$x1, 0);
if((CA_$0>HT_$0), CG_$0 = $f2* CG_$0 + (1-$f2)*$x1, 0)