Logically Same DOUBLE Precision Assignments, Different Results (42853)
The information in this article applies to:
- Microsoft QuickBASIC 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBASIC 4.5
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
- Microsoft Basic Professional Development System for MS-DOS 7.0
This article was previously published under Q42853 SUMMARY
Assigning SINGLE or DOUBLE precision variables to logically equivalent
expressions that use functions and temporary variables differently may
return values that vary slightly at the limits of their precision.
These variations can range above or below the expected integral value,
and can thus affect results returned from the INT function. This is
not a software problem, but is due to the way that the compiler
optimizes different expressions and rounds off values at the limits of
precision differently in different expressions. The binary math used
by the compiler cannot precisely represent all floating-point values
at each intermediate step in a calculation, and round-off errors are
unavoidable. For more information, query on the word IEEETUTR.
This information applies to Microsoft QuickBasic Versions 4.00, 4.00b,
and 4.50, to Microsoft Basic Compiler Versions 6.00 and 6.00b, and to
Microsoft Basic PDS Version 7.00. This occurs both in the QuickBasic
environment (or the QuickBasic Extended environment of Basic PDS 7.00)
and in executable programs compiled with BC.EXE.
| Modification Type: | Minor | Last Reviewed: | 8/16/2005 |
|---|
| Keywords: | KB42853 |
|---|
|