Re: Another chapter in the NeXT Tanh bug saga!
- To: mathgroup at yoda.ncsa.uiuc.edu
- Subject: Re: Another chapter in the NeXT Tanh bug saga!
- From: lsf at astrosun.TN.CORNELL.EDU (Sam Finn)
- Date: Tue, 5 Mar 91 11:11:38 EST
>Date: Mon, 4 Mar 91 13:48:41 PST >From: jel at corp.portal.com (John Little) >To: mathgroup at yoda.ncsa.uiuc.edu >Subject: Re: Another chapter in the NeXT Tanh bug saga! >The function tanh() returns a double. Unless you explicitly declare this >to be the case, the result that you get will not be useful, since the compiler >has no way of telling the type of the returned value. Math.h says >(among other things): > >extern double tanh(/* double x */); > > John > > >>Well! I've found another interesting piece of the Tanh[] puzzle! >> >>Stephen Wolfram made a posting implying that the Tanh bug >>was NeXT's fault: >> >>> printf("%g %g\n", tanh(-1.73287), tanh(-1.73288)); >>> >>> in a minimal C program on a NeXT under OS version 2.0 shows a >>> discontinuity. >>> >>> Mathematica (apparently mistakenly) relies on built-in math functions. >>> >>> Stephen Wolfram <swolf at dragonfly.wri.com> >> >>As you will see, that word "minimal" is STRICTLY true. > Unless explicitly declared otherwise, constants with decimals are doubles in c, so Wolfram's example is legitimate. (How do you declare a constant to be a float? with a trailing f or F, as in -1.73287F)