[GHC] #8539: Data.Complex shouldn't use default implementation of (**)

GHC ghc-devs at haskell.org
Mon Apr 28 00:30:15 UTC 2014


#8539: Data.Complex shouldn't use default implementation of (**)
-------------------------------------+-------------------------------------
        Reporter:  jjaredsimpson     |            Owner:
            Type:  bug               |           Status:  patch
        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):

 Adding the x>=0 is an improvement.

 If it's going to handle one infinity (i.e. +Infinity:+0) it's best to
 handle them all. There are lots of infinite complex numbers.
 {{{
 (x:+0) ** (y:+0)
   | x >= 0     =  (x ** y) :+ 0
 (re:+im) ** 0
   | isInfinite re || isInfinite im = 1:+0
 x ** y         =  exp (log x * y)
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8539#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list