Maybe stupid question but ...

BlitzMax Forums/BlitzMax Programming/Maybe stupid question but ...

Filax(Posted 2005) [#1]
Why :

In the window calculator 768/512 return 1.5

And under bmax :

Print 768/512

return 1 ?


Stuart Morgan(Posted 2005) [#2]
Try
Print Float(768)/Float(512)



assari(Posted 2005) [#3]
Print 768.0/512.0

returns 1.50000000

its the difference between integer math 768/512 versus floating point maths 768.0/512.0

An integer math produces only integer answers (as 1.5 is a float, so bmax rounded it down to a 1)


Filax(Posted 2005) [#4]
ok ! many thanks ! Sorry for stupid question ...


maximo(Posted 2005) [#5]
filax after all this time in blitz you forget something like that :)


Filax(Posted 2005) [#6]
Lol ! shame on me .... i'm tired at this time !


patmaba(Posted 2005) [#7]
t'as fumé trop d'herbe l'ami. :)


Warpy(Posted 2005) [#8]
(t'es pas le seule qui parle francais ici, patmaba. Watch what you say :) )


(tu) ENAY(Posted 2005) [#9]
Actually, this still catches me out sometimes today. So, no it's not that stupid, you can quite easily forgot that you haven't declared and int and then get the wrong results.