Microsoft KB Archive/42978

From BetaArchive Wiki

Tutorial for Understanding IEEE Floating-Point Errors in Basic

PSS ID Number: Q42978 Article last modified on 09-29-1992

1.00 MS-DOS

The information in this article applies to:
- The Standard and Professional Editions of Microsoft Visual Basic for MS-DOS, version 1.0 - Microsoft QuickBasic for MS-DOS, versions 3.0 (QB87.EXE coprocessor version only), 4.0, 4.0b, and 4.5 - Microsoft Basic Compiler for MS-DOS and MS OS/2, versions 6.0 and 6.0b - Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, versions 7.0 and 7.1

Summary: Floating-point mathematics is a complex topic that confuses many programmers. A tutorial is available in the Software/Data Library that should help you to recognize programming situations in which floating-point rounding errors are likely to occur, and to take steps to avoid them. It should also allow you to recognize cases that are caused by inherent floating-point math limitations as opposed to actual compiler bugs. This tutorial can be found in the Software/Data Library by searching for the word IEEETUTR, the Q number of this article, or S12243. IEEETUTR was archived using the PKware file-compression utility.

More Information: Basic may return floating-point results that are different than you might expect. More information on this topic can be found in the Microsoft Knowledge Base by querying on the following words: floating and point and format and QuickBASIC The IEEE floating point format is documented in the following manuals: 1. Pages 16-21 of “Microsoft QuickBASIC 4.0: BASIC Language Reference” for QuickBasic for MS-DOS, versions 4.0 and 4.0b. Note that 4.0 manuals need a correction on page 19 in the MHex$ code example, as explained in a separate article. More information on this topic can be found in the Microsoft Knowledge Base by querying on the following words: MHex$ AND 19 2. Pages 12-17 of “Microsoft QuickBasic 4.5: BASIC Language Reference” for QuickBasic for MS-DOS, version 4.5. Note that this optional manual must be ordered separately using an order card provided with version 4.5. 3. Pages 702-705 of the “Microsoft Basic: 7.0: Programmer’s Guide” for Basic PDS for MS-DOS, versions 7.0 and 7.1.

Additional reference words: 1.00 3.00 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10 Copyright Microsoft Corporation 1992.