How to get decimals in blitz?

Blitz3D Forums/Blitz3D Beginners Area/How to get decimals in blitz?

Jarvis(Posted 2004) [#1]
Hi,

When I run
print float(500/19)
i got 26.0 result.
Whatever I devide don't get decimal values.
when i try etc. print float(3.42 * 17) it return 58.14 as it should be

How Blitz handle this?


big10p(Posted 2004) [#2]
That's happening because the integer division of 500/19 is being done before it gets converted to a float. Just do 500.0/19.0 instead


Bot Builder(Posted 2004) [#3]
Or if you are doing vars, move the parenthesis to right after the first thing.

a=5
b=3
Print Float(a)/b