[GHC] #8532: Hyperbolic arc cosine fails on (-1) :: Complex r.
GHC
ghc-devs at haskell.org
Thu Nov 14 12:00:12 UTC 2013
#8532: Hyperbolic arc cosine fails on (-1) :: Complex r.
-------------------------------------+-------------------------------------
Reporter: leftaroundabout | Owner:
Type: bug | Status: new
Priority: low | Milestone:
Component: libraries/base | Version: 7.6.3
Keywords: | Operating System: Unknown/Multiple
Architecture: Unknown/Multiple | Type of failure: Incorrect result
Difficulty: Easy (less than 1 | at runtime
hour) | Test Case: acosh(-1) ::
Blocked By: | Complex Double
Related Tickets: | Blocking:
-------------------------------------+-------------------------------------
When allowing for complex results, the hyperbolic arc cosine is
continuously defined on all ℝ.
In the {{{(x < (-1))}}} real ray of the complex plane, {{{acosh}}} equals
{{{\z -> i * pi + acosh(abs z)}}}, which works fine for almost all
arguments. Thus, {{{acosh (-1)}}} should equal {{{i * pi}}}; however due
to the implementation as
{{{
acosh z = log (z + (z+1) * sqrt ((z-1)/(z+1)))
}}}
where the denominator in the root becomes zero at {{{z = -1}}}, this comes
out as {{{NaN :+ NaN}}}.
Could be fixed trivially by adding a special case
{{{
acosh ((-1):+0) = 0:+pi
}}}
to the {{{instance (RealFloat a) => Floating (Complex a)}}} in
{{{Data.Complex}}}.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8532>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list