Microsoft KB Archive/138522

= FIX: INT Function Returns Incorrect Value =

Article ID: 138522

Article Last Modified on 10/28/2003

-

APPLIES TO


 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition

-



This article was previously published under Q138522



SYMPTOMS
The INT function may, in some cases, return an incorrect value.



RESOLUTION
To work around this problem, don't perform a calculation inside the INT function. Assign the result to a variable and use the INT function on that variable. You can use the following sample code to convert your variable to an integer: Dim Result as Double Result = 3^2 Print INT(Result)



STATUS
Microsoft has confirmed this to be a bug in Microsoft Visual Basic Version 3.0 for Windows. This problem was corrected in Microsoft Visual Basic Version 4.0 for Windows.



Steps to Reproduce Problem
 Start a new project in Visual Basic version 3.0. Form1 is created by default.  Place the following code in the Click event for the form: Print INT(3^2)  Run the program, and click the form. An 8 prints instead of the expected 9.

Additional query words: 3.00 buglist3.00 fixlist4.00

Keywords: kbbug kbfix KB138522

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.