Smarter compiler?
Blitz3D Forums/Blitz3D Beginners Area/Smarter compiler?
| ||
Is there a better way to do this ?e#=1/2 DebugLog e# ;the compiler gives an integer result Input "" End r1#=1 r2#=2 f#=r1#/r2# DebugLog f# ;here the result is correct Input "" End |
| ||
Should be:-e#=1.0 / 2.0 DebugLog e# ;the compiler gives an integer result Input "" End or e#=Float#( 1 ) / Float#( 2 ) DebugLog e# ;the compiler gives an integer result Input "" End |
| ||
Thanks! |
| ||
what it does, because the values passed are integer, is work out 1/2 and gives the result as an integer which is then given to e#, even though it is a float the value given is rounded. |
| ||
@sinu: ja, that I knew. But that isn't how most compilers work. :) |