#324 atanh branch cut strangeness

clisp (525)

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
that the branch cut on [1, \infty) is continuous w/ 4th
quadrant and on (-\infty, -1] is continuous w/ 2nd

Clisp: conforms to spec

(2) atanh: CLHS says
that the branch cut on [1, \infty) is continuous w/
1st quadrant and on (-\infty, -1] is continuous w/ 3rd

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

    Robert Dodier - 2006-03-05

    Logged In: YES

    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

    Sam Steingold - 2006-06-20

    Logged In: YES

    could you please check the behavior of other cl implementation?
    is their interpretation of CLHS in line with yours?

  • Sam Steingold

    Sam Steingold - 2006-11-21

    Logged In: YES
    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

    Sam Steingold - 2006-11-21
    • labels: --> clisp
    • milestone: --> ANSI compliance issue
    • assigned_to: nobody --> sds
    • status: open --> closed-fixed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks