Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!srhqla!demott!kdq From: kdq@demott.com (Kevin D. Quitt) Newsgroups: comp.os.msdos.programmer Subject: Re: Microsoft C actually does something better! Message-ID: <1991Feb5.184015.9539@demott.com> Date: 5 Feb 91 18:40:15 GMT References: <8904@sail.LABS.TEK.COM> <1991Feb5.020455.26710@maytag.waterloo.edu> Organization: DeMott Electronics Co., Van Nuys CA Lines: 26 In article <1991Feb5.020455.26710@maytag.waterloo.edu> dmurdoch@watstat.waterloo.edu (Duncan Murdoch) writes: >In article <8904@sail.LABS.TEK.COM> toma@sail.LABS.TEK.COM (Tom Almy) writes: >>Microsoft C has been bad-mouthed here by myself and others over the years, >>but this past weekend I discovered at least one place where it beats the >>major competition -- the math library. Two cases: >> >>Case 1: { double x=1e200; printf("%g",x*x); } >>(With some compilers, the 80x87 has to have the overflow trap masked off). > >I tried your tests in Turbo Pascal 6.0, and was pleasantly surprised at the >results. (TP 6.0 has some real problems with esoteric floating point code.) >> >>Microsoft C (V6.00A): prints +inf (correct!) > >MSC may be correct for C, but TP prints 1.00000000E+0400, which is even more >correct. (This is because TP promotes expressions to the 10 byte extended >type.) When I forced the result to go into a double, I got an overflow >error; when I masked those, I got INF. It's more correct mathematically, but not according to the C language spec. There *are* (non-standard) ways in MSC to use the 10-byte reals. -- _ 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