WTF: 4 divided by 7 = 0, huh?!?

BlitzMax Forums/BlitzMax Programming/WTF: 4 divided by 7 = 0, huh?!?

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.

You're dividing two integers, giving you an integer result, and then casting the result to a double. No good casting when the division has already been done. Cast either ( or both ) sides of the equation before it occurs and you're fine.

Strict

Local objApp:clsMain = New clsMain;
objApp.main();

Type clsMain
 Method main()
	Print "START"
	Print Double(4)/7 '// windows calculator reports 4/7=0,57142857142857142857142857142857
 End Method
End Type