Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!wuarchive!uunet!zephyr.ens.tek.com!tekchips!sail!toma From: toma@sail.LABS.TEK.COM (Tom Almy) Newsgroups: comp.os.msdos.programmer Subject: Microsoft C actually does something better! Message-ID: <8904@sail.LABS.TEK.COM> Date: 4 Feb 91 19:02:20 GMT Reply-To: toma@sail.LABS.TEK.COM (Tom Almy) Organization: Tektronix, Inc., Beaverton, OR. Lines: 33 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). Microsoft C (V6.00A): prints +inf (correct!) Microway NDP C-386 (V1.4e): prints -*inf** (wrong sign!?!) Metaware High C DOS 386 (V1.62): prints infinity (correct!) Turbo C (C++ V1.0): hangs, requiring "three fingered salute". Zortech C (V2.18): prints 1.797693e+308 Case 2: { double x=1e50; x = sin(x); printf("%g", x);} ( matherr() function defined where available ) Microsoft: sine function causes error "Total loss of significance" (correct!) Microway: crashes, producing register dump, executing sine function. Metaware: with inline 80387 code, 1e50; with fp library, NaN (ok.) Turbo C: sine function causes error "Domain" (wrong error) Zortech C: prints garbage answer. A test of some other language compilers produced dismal results as well. Only Microsoft C worked. Tom Almy toma@sail.labs.tek.com Standard Disclaimers Apply -- Tom Almy toma@sail.labs.tek.com <<< Note new address Standard Disclaimers Apply