Floating numbers and precision

BlitzMax Forums/BlitzMax Beginners Area/Floating numbers and precision

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi, can somebody give me some advice? i have this small piece of code:

SuperStrict

Local w:Float = 0
Local n:Float = 1.
Local inc:Float = 0.1
Local result:Float = n + inc

Print result
result:+inc
Print result

End

What happens here is that float numbers doesnt appear to be very precise... the resulting printing gives

1.10000002 when it should be 1.10000000

1.20000005 when it should be 1.20000000

¿why?

Thanks in advance!