
#8539: Data.Complex shouldn't use default implementation of (**) -------------------------------------+------------------------------------- Reporter: jjaredsimpson | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Prelude | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: Incorrect result | Difficulty: Easy (less than 1 at runtime | hour) Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------- Comment (by Scott Turner): Agree with isaacdupree that 0{{{**}}}0 == 1.0 The above {{{ x ** y = if x == 0 then 0 else exp (log x * y) }}} is incorrect for negative y. Consider {{{ $ ghci GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Prelude> 0.0**(-2.0) Infinity }}} There are other interesting cases. If the real part of y is positive, then the result should be 0. If the real part is negative, then the result should be Infinity. If y is imaginary, the result should be NaN. For the most part, {{{ Infinity ** y = 0 ** (negate y) }}} I won't address -0 and 0:+(-0) because they deserve more controversy than I can handle. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8539#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler