10/3=3??!!

Blitz3D Forums/Blitz3D Programming/10/3=3??!!

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.

Common 'mistake'

Blitz is performing integer math and therefore returning an integer result (regardless of the variable type).

The solution: Just make any of the arguments involved a floating point number:

temp# = 10.0 / 3
temp# = 10 / 3.0
temp# = 10.0 / 3.0

or

temp# = float(10) / 3
temp# = 10 / float(3)
temp# = float(10) / float(3)