FIX: INT() Rounds Large Negatives Badly If Compiled in 1.00 (69165)






This article was previously published under Q69165

SYMPTOMS

The INT() function in QuickBasic version 1.00 for the Macintosh rounds large negative numbers incorrectly in compiled programs. This problem does not occur when programs are run inside the QuickBasic 1.00 interpreter environment.

Microsoft has confirmed this to be a bug in Microsoft QuickBasic version 1.00 for the Macintosh . This problem is corrected by Microsoft QuickBasic versions 1.00a (and 1.00b).

MORE INFORMATION

The following sample code demonstrates the incorrect results in a compiled program:

Sample Code

FOR i% = 1 TO 6
  A# = (((10^i%) * -1234#) + .5)
  PRINT A#, INT(A#)
NEXT i%
				

Incorrect Output Results

-12349.5         -12340
-123499.5        -123400
-1234999.5       -1234000
-12349999.5      -12339999
-123499999.5     -123399999
-1234999999.5    -1233999999
				

Expected Output Results

-12349.5         -12340
-123499.5        -123400
-1234999.5       -1234000
-12349999.5      -12340000
-123499999.5     -123400000
-1234999999.5    -1234000000
				

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: kbbug KB69165