Decimals numbers not possible?
BlitzMax Forums/BlitzMax Beginners Area/Decimals numbers not possible?
| ||
I just tried this :local a:float a=1/60 Print a and got a 0.00000. Is there any way to get the decimals to appear? |
| ||
Blitz sees "1/60" as "integer 1" divided by "integer 60," so it returns an integer result (0 in this case) which is then converted to float when assigned to "a." If you make either or both of the numbers involved into floats, you'll get a float result (0.0166666675):Local a:Float a = 1.0 / 60 Print a a = 1 / 60.0 Print a |
| ||
ahh...make sense, thanks! |
| ||
Or if you want to use immediate stuff: Float(1) / 60 will do the same. |
| ||
Or 1/60:Double |
| ||
Cool..thanks guys...didnt know Max can do casting also... |