🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #18531

Bug in LSC or the transcendental functions package?

#18531
From: benjamin Waldman
Date: Thu, 27 Aug 1987 15:47
32 lines
1741 bytes
Yesterday, I came across what I think is a bug in either LightSpeed
C or the transcendental functions package.

After I generate a NAN(033) (illegal argument to trig function), the
tangent function seems to stop working (returns a bad value), even
though sine and cosine continue to work properly.

My code looked something like this:

double a=1;
double b=0;
double c;

printf("%f %f %f\n",sin(PI/4),tan(0),tan(PI/4));  /* I get correct answers */
c=a/b;  /* c now is an infinity bit pattern */
printf("%f %f\n",c,sin(c)); /* outputs   INF NAN(033) */
printf("%f %f %f\n",sin(PI/4),tan(0),tan(PI/4));

For this last line, I get the correct answer for sine, but the tangents
just give question marks, e.g. the output was .7071etc. ? ?.

Why would this happen?  There is a bug somewhere, obviously.  I am using
LSC v2.01, and System 2.something (because I'm using an unenhanced 512K mac).
Is this something that has been corrected in a later system?

				Thanks
 				Ben Waldman
 
waldman%husc4@harvard.ARPA	waldman@husc4.harvard.edu
waldman@husc4.UUCP		waldman@HARVUNXU.BITNET
..{seismo, harpo, ihnp4, linus, allegra, ut-sally}!harvard!husc4!waldman
Technical Details
Message-ID: <2767@husc6.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!endor!waldman

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!endor!waldman
From: waldman@endor.harvard.edu (benjamin Waldman)
Newsgroups: comp.sys.mac
Subject: Bug in LSC or the transcendental functions package?
Message-ID: <2767@husc6.UUCP>
Date: Thu, 27-Aug-87 11:47:07 EDT
Article-I.D.: husc6.2767
Posted: Thu Aug 27 11:47:07 1987
Date-Received: Sat, 29-Aug-87 09:57:08 EDT
Sender: news@husc6.UUCP
Reply-To: waldman@endor.UUCP (benjamin Waldman)
Organization: Aiken Computation Lab Harvard, Cambridge, MA
Lines: 32