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

GHC ghc-devs at haskell.org
Mon Apr 14 14:47:16 UTC 2014


#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 yalas):

 I think this will be enough:
 {{{
 (x:+0)**(y:+0) =  (x ** y) :+ 0
 x ** y         =  exp (log x * y)
 }}}
 Testing:
 {{{
 Prelude Data.Complex> 0**0 :: Complex Double
 1.0 :+ 0.0
 Prelude Data.Complex> 0**2 :: Complex Double
 0.0 :+ 0.0
 Prelude Data.Complex> 0**(-2) :: Complex Double
 Infinity :+ 0.0
 }}}

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


More information about the ghc-tickets mailing list