DisableMath() ------------- Date of Release: 3/20/95 A function to disable Clipper's usage of the math coprocessor for Clipper 5.2, 5.01, 5.0, and Summer '87. The following files, DISMATH.OBJ and DISMATH.ASM, have been placed in the public domain by Greg Martin of Horizon Real-Time Systems. You may use, modify and distribute these files as you see fit provided the comments in DISMATH.ASM concerning original authorship are not modified. The purpose of the DisableMath() function is to disable Clipper's usage of the math coprocessor when the program detects a faulty Pentium chip thus allowing the program to continue execution without the danger of an invalid computation being performed. It will also disable Clipper's usage of any math coprocessor, not just the Pentium's, although I can think of no potential benefit for disabling the use of a perfectly good math coprocessor. To use the DisableMath() function simply do a well-known computational test for a faulty Pentium and if the program determines the computation has erred then call DisableMath(). The following example should suffice: * Near beginning of program... IF 4195835 - ((4195835 / 3145727) * 3145727) != 0 * Faulty Pentium found so disable math coprocessor usage DisableMath() ENDIF DISMATH.OBJ can be linked into your executable like any other C/ASM file -- simply add it to your linker command line or link file. If you are using Blinker to create real-mode applications, it can be dynamically overlaid. It is also compatible with protected-mode linkers such as ExoSpace, Blinker, and Causeway. As stated above, this function will work with versions of Clipper from Summer '87 to Clipper 5.2 (this was one section of Clipper that didn't change for many years), but it won't work with Clipper 5.3 or above because Clipper 5.3 began using a different math library. Please note that this function DOES NOT disable the math coprocessor itself, but only Clipper's usage of it. It does this by simply resetting a flag deep inside the bowels of Clipper which causes Clipper to use its own internal math library. Also note that some third party libraries might do their own floating point math bypassing Clipper's math library. In that case those third party routines might be affected by the Pentium bug. Also note that if you have written your own C code and are linking in Microsoft's LLIBCE.LIB library (instead of the recommended LLIBCA.LIB) then your Clipper code will still use the math coprocessor and be susceptible to the Pentium bug. You can use the enclosed TESTMATH.PRG sample code to verify the proper functioning of the DisableMath() function. Finally, the author grants no warranties, express or implied, by statute or otherwise, regarding the fitness of this code for any purpose and in no event shall be liable for any special, consequential, or other damages. Use at your own risk! After all this is public domain software and if $1000 commercial software comes with such disclosures then surely this code qualifies too. If you have any comments, please send them to my CompuServe address below. Greg Martin Horizon Real-Time Systems, Inc. CompuServe ID 73707,3450