petdance/scratch — Issue #363: Problems with acosh, asech, atanh and acoth  in Complex PMC
Author: petdance
Created: 2011-11-01 05:42:08+00:00
State: open
Labels: bug, core, Pri-normal, Sev-medium

Hello,
While doing [http://www.google-melange.com/gci/task/show/google/gci2010/parrot_perl_foundations/t129193205977 this GCI task] I had some problems with "acosh".

Here is the output of tests that I wrote:
{{{
not ok 529 - acosh of 0-1i
# Have: -0.881374+1.570796i
# Want: 0.881374-1.570796i

not ok 530 - acosh of 0-0.5i
# Have: -0.481212+1.570796i
# Want: 0.481212-1.570796i

not ok 535 - acosh of 2-3i
# Have: -1.983387+1.000144i
# Want: 1.983387-1.000144i

not ok 537 - acosh of -2-3i
# Have: -1.983387+2.141449i
# Want: 1.983387-2.141449i
}}}

The "want" values were taken from WolframAlpha (ex [http://www.wolframalpha.com/input/?i=acosh(2-3i)]).

Some other methods that relies on "acosh" are also returning a wrong value, like "asech".

{{{
not ok 587 - asech of 0.5+0i
# Have: -1.316958+0.000000i
# Want: 1.316958+0.000000i

not ok 593 - asech of 0+0.5i
# Have: -1.443635+1.570796i
# Want: 1.443635-1.570796i

not ok 594 - asech of 0+1i
# Have: -0.881374+1.570796i
# Want: 0.881374-1.570796i

not ok 595 - asech of 0+2i
# Have: -0.481212+1.570796i
# Want: 0.481212-1.570796i

not ok 596 - asech of 2+3i
# Have: -0.231335+1.420411i
# Want: 0.231335-1.420411i

not ok 598 - asech of -2+3i
# Have: -0.231335+1.721182i
# Want: 0.231335-1.721182i
}}}

I also found some errors in "atanh" and "acoth":
{{{
not ok 538 - atanh of -2+0i
# Have: -0.549306-1.570796i
# Want: -0.549306+1.570796i

not ok 554 - acoth of -0.5+0i
# Have: -0.549306-1.570796i
# Want: -0.549306+1.570796i
}}}

The tests that I wrote can be found here: https://github.com/fernandobrito/parrot/commits/gci_tests

Environment: Ubuntu 10.10, Parrot 2.10.1 (master branch), Perl 5.10.1 i686-linux-gnu-thread-multi, cc (gcc 4.4), i386, linux

Originally http://trac.parrot.org/parrot/ticket/1891