Path: utzoo!utgpu!watserv1!watmath!att!bellcore!rutgers!usc!srhqla!demott!kdq From: kdq@demott.COM (Kevin D. Quitt) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: MSC 6.0 and Turbo C 2.0 floating point accuracy Message-ID: <310@demott.COM> Date: 16 Jun 90 00:07:14 GMT References: <491@van-bc.wimsey.bc.ca> Reply-To: kdq@demott.COM (Kevin D. Quitt) Organization: DeMott Electronics Co., Van Nuys CA Lines: 54 Results from MSC 6.0 First column under Microsoft uses in-line 80x87 instructions (/FPi87), second column is for both 8087-compatible library calls (no fpu: /FPc), and for their alternate math library (/FPa). All compilations were otherwise: /AS /Od /Zp1 /G1 Table 1: Results using the xmemcof.c driver routine. Published results appeared in _Numerical Recipes in C_. Index Published VAX-C Turbo C Microsoft C 1 1.261539 1.261540 1.261540 1.261539 1.261540 2 -0.007695 -0.007694 -0.007694 -0.007695 -0.007693 3 -0.646778 -0.646779 -0.646779 -0.646777 -0.646780 4 -0.280603 -0.280603 -0.280603 -0.280602 -0.280604 5 0.163693 0.163692 0.163692 0.163691 0.163693 6 0.347674 0.347676 0.347676 0.347675 0.347676 7 0.111247 0.111247 0.111247 0.111247 0.111247 8 -0.337141 -0.337142 -0.337142 -0.337141 -0.337142 9 -0.358043 -0.358043 -0.358043 -0.358044 -0.358043 10 0.378774 0.378774 0.378774 0.378775 0.378774 Table 2: Results using the xspctrm.c driver routine (overlapped case). Index Published VAX-C Turbo C Microsoft C 1 - 0.001993 0.001993 0.001993 0.001993 2 - 0.001461 0.001461 0.001461 0.001461 3 - 0.072356 0.072356 0.072356 0.072356 4 - 0.062723 0.062723 0.062723 0.062723 5 - 0.097625 0.097625 0.097625 0.097625 6 - 0.014102 0.014102 0.014102 0.014102 7 - 0.000089 0.000089 0.000089 0.000089 8 - 0.000210 0.000210 0.000210 0.000210 9 - 0.000052 0.000052 0.000052 0.000052 Compiling with 5.1, I was able to duplicate the erroneous results only by selecting the emulation library, and not using the 80x87 instructions. This is a farily bizarre thing to do if you don't have a coprocessor, you should be using the alt-math library, since it's significantly faster than the emulator. It also produces the correct answers. I have yet to find a compiler (on any machine) whose default switches were satisfactory even most of the time. -- _ Kevin D. Quitt demott!kdq kdq@demott.com DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266 VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last 96.37% of all statistics are made up.