Newsgroups: comp.os.msdos.programmer
Path: utzoo!utgpu!watserv1!maytag!watstat.waterloo.edu!dmurdoch
From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch)
Subject: Re: Microsoft C actually does something better!
Message-ID: <1991Feb5.020455.26710@maytag.waterloo.edu>
Sender: daemon@maytag.waterloo.edu (Admin)
Organization: University of Waterloo
References: <8904@sail.LABS.TEK.COM>
Date: Tue, 5 Feb 91 02:04:55 GMT
Lines: 32

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.
>
>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!)

TP just gives an invalid operation error, or a NAN when masked.

>A test of some other language compilers produced dismal results as well.
>Only Microsoft C worked.

And TP!

Duncan Murdoch
dmurdoch@watstat.waterloo.edu
