lundi 5 juillet 2021

if(x <= 0) just stops running with an input of 0 [closed]

I'm trying to check if an input is equal to or less than zero. The input could be a minus number zero or a positive number. If I use <0 and input 0.00000000001, it works fine. If I use <=0 the program just stops after I input the zero.

This is my code:

 if (cHeight < 0 )
 {
     H2 = cBall - (cRad-H1)+(Math.abs(cHeight));    
 }
 else
 {
     H2 = cBall - (cRad-H1)-(cHeight);

Aucun commentaire:

Enregistrer un commentaire