Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/38285

From BetaArchive Wiki

Detecting Presence of 80x87 Math Coprocessor

Q38285

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a | 1.00 1.50 MS-DOS | OS/2 | WINDOWS kbprg ---------------------------------------------------------------------- The information in this article applies to: - Microsoft C for MS-DOS, versions 5.1, 6.0, 6.0a, and 6.0ax - Microsoft C for OS/2, versions 5.1, 6.0, and 6.0a - Microsoft C/C++ for MS-DOS, version 7.0 - Microsoft Visual C++ for Windows, version 1.0 and 1.5 ---------------------------------------------------------------------- SUMMARY ======= There is no direct way to query the Microsoft C floating-point libraries to determine whether a math coprocessor is being used. Compiling using /FPi indicates that you don't want to worry about whether a coprocessor is present. Consequently, the compiler generates code that will do the following: 1. Checks to see if a 80x87 coprocessor is present. 2. If so, uses it. 3. If not, emulates it with software routines. There is nothing in this algorithm to tell your program what it found. The only way you'll know it's emulating the coprocessor is by observing how slowly your program runs. MORE INFORMATION ================ If you want to know whether a coprocessor is present, you'll have to test it yourself. For more information on how to test for the presence of an 80x87 coprocessor, please consult Intel's "80286 and 80287 Programmer's Reference Manual," pages 3-2 and 3-3 (in the second half of the book). This section is titled "System-Level Numeric Programming," and states that your program can detect the presence of the 80287 NPX. It then gives an assembly-language example that works correctly for both 8086- and 80286-based machines. You can use this routine in your program as follows: 1. During initialization of your program, call the short Intel routine to see if a coprocessor is present. 2. If there is a coprocessor, proceed normally. 3. If there is no coprocessor, put up a message box explaining the following to the user: Your computer lacks a coprocessor, but will emulate it in software; this emulation will slow down the calculations that needs to perform. To increase the performance of , as well as other programs, add a numeric coprocessor to your system. 4. Proceed with your program as you normally would. The C run-time libraries will automatically adjust for the presence or lack of an 80x87. Additional reference words: kbinf 1.00 1.50 5.10 6.00 6.00a 6.00ax 7.00 8087 80287 80387 KBCategory: kbprg KBSubcategory: CLngIss

Keywords : kb16bitonly
Issue type :
Technology : kbVCsearch kbAudDeveloper kbPTProdChange kbvc150 kbvc100 kbCCompSearch kbZNotKeyword3 kbCComp510DOS kbCComp600DOS kbCComp600aDOS kbCComp600axDOS kbCComp510OS2 kbCComp600OS2 kbCComp600aOS2 kbCVC700DOS


Last Reviewed: May 6, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.