FB Can't count!?
Quote from Forum Archives on November 21, 1997, 5:55 amPosted by: benjamen <benjamen@...>
Can someone please try this code for me. As the demo will show you, if
BOTH of the passed vars exceed 100001 and 10001, then the calculations
turn out incorrect!
I thought the brackets might be causing the long to be clipped to a
short, but in all cases the results are off by only 1 ??Jamin
---- Cut Here For Code Snippet ------
WINDOW OFF
DIM gUserQuits%
END GLOBALSLOCAL FN BadCalculation(VauleOne&,ValueTwo&)
PRINT VauleOne&;"-";ValueTwo&;" = ";Incorrect& = (VauleOne&) -ValueTwo&
Correct& = VauleOne& -ValueTwo&PRINT Incorrect&;
IF Correct& Incorrect& THEN PRINT ;" <- WRONG! Should be:";Correct&
ELSE PRINT ""END FN
WINDOW 1
TEXT _monaco,9,0,0FN BadCalculation(100000,10000)
FN BadCalculation(100001,10000)
FN BadCalculation(100000,10001)
FN BadCalculation(100001,10001)
FN BadCalculation(100002,10002)DO
HANDLEEVENTS
UNTIL gUserQuits%
END
Posted by: benjamen <benjamen@...>
BOTH of the passed vars exceed 100001 and 10001, then the calculations
turn out incorrect!
I thought the brackets might be causing the long to be clipped to a
short, but in all cases the results are off by only 1 ??
Jamin
---- Cut Here For Code Snippet ------
WINDOW OFF
DIM gUserQuits%
END GLOBALS
LOCAL FN BadCalculation(VauleOne&,ValueTwo&)
PRINT VauleOne&;"-";ValueTwo&;" = ";
Incorrect& = (VauleOne&) -ValueTwo&
Correct& = VauleOne& -ValueTwo&
PRINT Incorrect&;
IF Correct& Incorrect& THEN PRINT ;" <- WRONG! Should be:";Correct&
ELSE PRINT ""
END FN
WINDOW 1
TEXT _monaco,9,0,0
FN BadCalculation(100000,10000)
FN BadCalculation(100001,10000)
FN BadCalculation(100000,10001)
FN BadCalculation(100001,10001)
FN BadCalculation(100002,10002)
DO
HANDLEEVENTS
UNTIL gUserQuits%
END