Interesting comments
Quote: "print 1/2, " ", 1/2.0, " ", (1/2)/1.0"
The third expression contains a parenthetical division that results with zero divided by 1.0, this is the same even without the parentheses.
All of the following expressions contain at least one floating point return and outputs a positive floating point result:
a = 1
b = 2
c = 3
d = 4
e# = 0.5
f# = 2.5
g# = 4.0
Print 1.0/2/1
Print a*e#
Print e#/c
Print b/f#
Print c/g#
Print e#*c
Print a/e#*f#/g#
Print e#/c*e#
Print b/f#/c
Print c/g#/d
Print e#*c/b
Print Screen Width()*e#
Print Int(Sin(35)*10)/4.0
Print 10/15.0
Print 15/10.0
Wait Key
And the following contains integer returns and outputs an integer result:
a = 1
b = 2
c = 3
d = 4
e# = 0.5
f# = 2.5
g# = 4.0
Print 4/2
Print 10*2
Print Int(e#)*1
Print Int(e#)*Screen Width()
Print 4/Ceil(e#)*a
Print 2/Floor(f#)*b
Print 1/Ceil(0.5)
Print 2/Int(2.2)
Wait Key
On the topic of division, you could use a similar function to prevent the division by zero error:
a=0:b=0
// Print a/b ` Error
Print Div(a,b)
Wait Key
End
//=============================================================
Function Div(fVal#, fDivisor# )
f# = 0
If fVal# <> 0
If fDivisor# <> 0
f# = fVal# / fDivisor#
Endif
Endif
Endfunction f#