Decimals numbers not possible?

BlitzMax Forums/BlitzMax Beginners Area/Decimals numbers not possible?

Neuro(Posted 2005) [#1]
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?


WendellM(Posted 2005) [#2]
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



Neuro(Posted 2005) [#3]
ahh...make sense, thanks!


TeraBit(Posted 2005) [#4]
Or if you want to use immediate stuff:

Float(1) / 60

will do the same.


FlameDuck(Posted 2005) [#5]
Or 1/60:Double


Neuro(Posted 2005) [#6]
Cool..thanks guys...didnt know Max can do casting also...