Divide problem

Blitz3D Forums/Blitz3D Programming/Divide problem

Craig H. Nisbet(Posted 2005) [#1]
Can anyone tell me why this will not return the correct value of 0.78125 ?

GW# = 800/1024

It spitting out 0.0


GW(Posted 2005) [#2]
try Float(Float(800)/Float(1024))
that should do it ;)


Tom(Posted 2005) [#3]
gw# = 800.0/1024 works


Ross C(Posted 2005) [#4]
Yea, you need to put the decimal point in one or both of the numbers, or blitz assumes your looking for an integer result. Even if the target variable is a float.


_PJ_(Posted 2005) [#5]
Yeah I think Blitz does this to speed up stuff or conserve memory somewhere, but it always tries to use integers unless expressly decreed that you want a float!