I am running the code below. The function Ax returtns the value 1. But the ifelse statement does not recognize that Ax==1.
I've tried making the output of the function double-precision and all numeric values double. This hasn't worked.
I was hoping:
1) to get help troubleshooting this specific case
2) to get tips on how to avoid this problem in the future
Axfun<-function(beta,gamma,a,b,g,H0stud,Wh,Wi){
((b*beta + g*gamma)*(1 + 2*g*gamma)*(1 + gamma + b*((-beta)*(1 + gamma) + a*(-1 + beta)*(1 + g*gamma)))*H0stud*Wi)/
((-1 + b*beta)*(1 + gamma)*((-g)*gamma*(1 + 2*g*gamma)*Wi + b*beta*((-1 + g*gamma*(-2 + H0stud) + H0stud)*Wh - (1 + g*gamma)*H0stud*Wi)))
}
Ax<-Axfun(2^1,
2^0,
2^0,
2^-3,
2^-1,
1,
1,
0.4)
ifelse(Ax>=1, 0, Ax)