waldman@endor.harvard.edu (benjamin Waldman) (08/27/87)
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