So far as I can tell, Clisp 2.34 (Linux, compiled w/
gcc 3.3.2) handles branch cuts of atanh incorrectly. I
also checked asin and acos and those two functions seem OK.
(1) acos and asin: CLHS says
(http://www.lispworks.com/documentation/HyperSpec/Body/f_asin_.htm)
that the branch cut on [1, \infty) is continuous w/ 4th
quadrant and on (-\infty, -1] is continuous w/ 2nd
quadrant.
Clisp: conforms to spec
(2) atanh: CLHS says
(http://www.lispworks.com/documentation/HyperSpec/Body/f_sinh_.htm)
that the branch cut on [1, \infty) is continuous w/
1st quadrant and on (-\infty, -1] is continuous w/ 3rd
quadrant.
Clisp: continuous w/ 4th and 2nd quadrants respectively
PS. Here's a test script:
(cl:asin #C(2.5 0.01))
(cl:asin 2.5)
(cl:asin #C(2.5 -0.01))
(cl:asin #C(-2.5 0.01))
(cl:asin -2.5)
(cl:asin #C(-2.5 -0.01))
(cl:acos #C(2.5 0.01))
(cl:acos 2.5)
(cl:acos #C(2.5 -0.01))
(cl:acos #C(-2.5 0.01))
(cl:acos -2.5)
(cl:acos #C(-2.5 -0.01))
(cl:atanh #C(2.5 0.01))
(cl:atanh 2.5)
(cl:atanh #C(2.5 -0.01))
(cl:atanh #C(-2.5 0.01))
(cl:atanh -2.5)
(cl:atanh #C(-2.5 -0.01))
Robert Dodier
2006-03-05
Logged In: YES
user_id=501686
After further study of CLHS, I've concluded the statements
about branch cuts for ATANH are inconsistent with the
formula (log(1 + x) - log(1 - x))/2. The branch cuts as
derived from the formula are (-\infty, -1) continuous w/ 2nd
quadrant and (1, \infty) continuous w/ 4th. I think the only
way to read the spec for ATANH is to read the stuff about
branch cuts as commentary and ignore it (i.e., observe the
formula and ignore the commentary).
That said, there is still some strangeness in ATANH, namely
that (ATANH -2.5) => #C(-0.42364892 1.5707964) which is
different from (ATANH #C(-2.5 0.0)) => #C(-0.42364892
-1.5707964). Since Clisp doesn't recognize signed zero, I
don't see how that can be. For the record, (IMAGPART -2.5)
=> 0 and (PHASE -2.5) => 3.1415927.
In order to be consistent w/ (log(1 + x) - log(1 - x))/2,
(ATANH #C(-2.5 0.0)) should yield #C(-0.42364892 1.5707964).
Sam Steingold
2006-06-20
Logged In: YES
user_id=5735
could you please check the behavior of other cl implementation?
is their interpretation of CLHS in line with yours?
Sam Steingold
2006-11-21
Logged In: YES
user_id=5735
Originator: NO
thank you for your bug report.
the bug has been fixed in the CVS tree.
you can either wait for the next release (recommended)
or check out the current CVS tree (see http://clisp.cons.org\)
and build CLISP from the sources (be advised that between
releases the CVS tree is very unstable and may not even build
on your platform).
Sam Steingold
2006-11-21