delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/01/15:05:43

From: Kbwms <Kbwms AT aol DOT com>
Message-ID: <13a102f7.354a1c82@aol.com>
Date: Fri, 1 May 1998 15:03:29 EDT
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Problem with sinh() in libm.a

This is a multi-part message in MIME format.

--part0_894049409_boundary
Content-ID: <0_894049409 AT inet_out DOT mail DOT aol DOT com DOT 1>
Content-type: text/plain; charset=US-ASCII

There seems to be a problem with sinh(z) in the math library, libm.a,
for small values of z.  For example, when z = 1.e-7, we should get
sinh(z) = 1.00000000000000168e-07.  Actual results differ as shown
below.

I wrote a driver that produced the following printout:

l_sinh(9.99999999999999955e-08) = 9.99999999999633745e-08 (library version)
w_sinh(9.99999999999999955e-08) = 9.99999999999633745e-08 (from djlsr202.zip)
s_sinh(9.99999999999999955e-08) = 1.00000000000000168e-07 (series expansion)
c_sinh(9.99999999999999955e-08) = 1.00000000000000168e-07 (ix87 FPU function)

The first line shows the result of a call to sinh() in libm.a.  The
second line shows the result of calling a version of sinh() that was
produced from source extracted from djlsr202.zip.

The third and fourth lines show the correct results.  The series expansion
calculates sinh() from three terms, sinh(x) = x + x^3/6 + x^5/120.  The
fourth result was obtained by taking sinh() from the FPU (via __math.h).

Regretfully, I am not familiar enough with the code used in the library
version to recommend a fix.

Source files for the driver and subordinate functions are attached in a
zip file, tstsinh.zip.

K.B. Williams

--part0_894049409_boundary--

- Raw text -


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