Uhhhhh....
Blitz3D Forums/Blitz3D Programming/Uhhhhh....
| ||
This is so annoying. Can anyone explain why,Print 1/2 If (1/2)<>.5 Print "There's a problem" spits out, 0 There's a problem instead of just .5? |
| ||
1 and 2 are treated as integer, therefore the result will also be integer. To get a float result, either or both sides of your equation should also be a float Print 1/2.0 |
| ||
/\ True....and your example still may not work. Generally speaking, don't compare floating point values with =. Instead use something that allows for some errors, e.g: To check if x 'equals' 0.5: if (abs(x-0.5)<0.0001) |
| ||
>This is so annoying. Can anyone explain why, 2 issues. Blitz expects you to use floats in if you want floats out... Secondly. Floats are inherently imprecise, which means that you should not compare floats to precise numbers. Andy |
| ||
Alright then, thanks everyone. |