Why the math 1/2 dont return 0.5 ;
-
Hi, i have a strange problem, i have the code float test = 1/2;
but returns test= 0 ;i cannot understand this, and my code don't work !
See the screen shot from debugger!The problem is that the code on line 299 if(((dt%temp.period)==0), also dont work and i discover this inconvenience!
-
Not that any reasonable compiler wouldn't see this but why not just do this?
@
float test = 0.5f;
@
@andreyc - again, not that any compiler wouldn't see this but if you define a float avoid downcasting from a double:
@
float test = 1.0f/2.0f;
@