delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/12/18:04:35

From: Kbwms <Kbwms AT aol DOT com>
Message-ID: <42dba229.3558c70d@aol.com>
Date: Tue, 12 May 1998 18:02:52 EDT
To: eliz AT is DOT elta DOT co DOT il
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: Code to Fix sinh() in libm.a

Subj:	 Re: Code to Fix sinh() in libm.a
To:	eliz AT is DOT elta DOT co DOT il (Eli Zaretskii):

Dear Eli Zaretskii,

On 05-11-98 at 05:04:28 EST you wrote:
>
>
> On Sun, 10 May 1998, Kbwms wrote:
>
> > As it turns out, tsinh.exe in ELEFUNT already exhibits the problem:
>
> Are these results with the stock libm version or with the corrected
> version that you posted?
>
The results sent were for the version that the makefile uses.  It is
evident that the makefile needs some overhaul unless it is intended
that libc always be the preferred library.  I built two versions of
tsinh.exe which I called tsinhkb.exe and tsinhlm.exe to test the two
versions, mine and sinh from libm respectively.  For small arguments,
both versions produced the same results:

 THE IDENTITY SINH(X) = X , X SMALL, WILL BE TESTED.

        X         X - F(X)

  1.0179359e-16  0.0000000e+00

  5.0896794e-17  0.0000000e+00

  2.5448397e-17  0.0000000e+00

  1.2724199e-17  0.0000000e+00

  6.3620993e-18  0.0000000e+00


The original complaint was with argument on the order of 1.e-7.  When
I ran tsinh  and my version of sinh() on this argument, here is what I got:

 Special Value x = 1.e07 - should produce 1.00000000000000167e-7
9.999999999999999547E-08  1.000000000000001675E-07

 THE IDENTITY  SINH(-X) = -SINH(X)  WILL BE TESTED.

        X            F(X) + F(-X)

  1.6670571e-01  0.0000000e+00

  2.8382135e+00  0.0000000e+00

  7.7668288e-01  0.0000000e+00

  1.0853600e+00  0.0000000e+00

  6.7000500e-01  0.0000000e+00


I show some extra printout because this same printout using the libm
version yields:

 Special Value x = 1.e07 - should produce 1.00000000000000167e-7
9.999999999999999547E-08  9.999999999996337453E-08

 THE IDENTITY  SINH(-X) = -SINH(X)  WILL BE TESTED.

        X            F(X) + F(-X)

  1.6670571e-01 -4.9060148e-18

  2.8382135e+00  6.7740952e-16

  7.7668288e-01  2.1684043e-19

  1.0853600e+00  2.2768246e-18

  6.7000500e-01 -1.3227267e-17


This last set of results is an outrage.  First, the answer for
sinh(1.e-7) misses the mark as reported previously.  Secondly,
the identity F(X) = -F(-X) is not met.

> I think you are qualified more than many others, and since you
> discovered the problem, I hoped you would have enough motivation to
> get it fixed.
>
> IMHO, fixing it doesn't require more than adding a special case to the
> original code that handles the cases of small arguments.  Then most of
> the concerns I expressed are taken care of automagically, and running
> ELEFUNT should show that.
>
> Nothing in DJGPP gets done unless there are individuals who are
> motivated enough to do it.  Since the original `sinh' is in use for
> many years and nobody complained until now, it will probably not get
> fixed any time soon, unless you help fixing it.  I urge you to
> consider this again.

Okay, I will.  Thanks for your patience.  Clearly, one of the problems
is that no one pays any attention to what ELEFUNT produces.  I intend
to run the stuff through my version of ELEFUNT because it is much more
comprehensive.  Of course, I'll report the results from ELEFUNT, too.

Here is what my test program produces for arguments in (1.e-7, 2.e-7):

Test 5: sinh(x) for 1000 values in (1E-07, 2E-07)
Result was smaller 0 times, equal 0 times, and larger 1000 times
The maximum relative error of 5.2760127189E-13 = 2 ^ -40.79
	occurred for x = 1.0240897337044759172E-07
Estimated loss of base 2 significant digits  is 12.21
The root-mean-square relative error was 6.997437252E-15 = 2 ^ -47.02
Estimated loss of base 2 significant digits  is 5.98


At x = 1.02e-7, over 12 bits of accuracy are lost.  The RMS
error over the range show that nearly 6 bits RMS are lost.

The scandalous behavior reported above for the identity
sinh(x) = -sinh(-x) is shown again:

sinh(x) vs. sinh(-x) for random values
	x = 1.7313932765, sinh(x) + sinh(-x) = 5.247538515E-17
	x = 2.5142214602, sinh(x) + sinh(-x) = -5.074066167E-17
	x = 1.8964167239, sinh(x) + sinh(-x) = 7.090682208E-17
	x = 2.5792200716, sinh(x) + sinh(-x) = 3.955169525E-16
	x = 2.1011919701, sinh(x) + sinh(-x) = 3.851086117E-16


Regards,

K.B. Williams

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019