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

GHC ghc-devs at haskell.org
Wed Apr 30 11:17:39 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 yalas):

 Other floating functions seems to be ok (or almost ok) with infinity:
 {{{
 Prelude Data.Complex> sqrt $ 1/0 :+ 0
 Infinity :+ 0.0
 Prelude Data.Complex> sqrt $ 1/0 :+ 1/0
 Infinity :+ NaN
 Prelude Data.Complex> sqrt $ (-1/0) :+ 0
 0.0 :+ Infinity
 Prelude Data.Complex> sqrt $ (-1/0) :+ (-1/0)
 NaN :+ (-Infinity)

 Prelude Data.Complex> log $ 1/0 :+ 0
 Infinity :+ 0.0
 Prelude Data.Complex> log $ 1/0 :+ 1/0
 Infinity :+ NaN
 Prelude Data.Complex> log $ (-1/0) :+ 0
 Infinity :+ 3.141592653589793
 Prelude Data.Complex> log $ 0 :+ 0
 (-Infinity) :+ 0.0
 Prelude Data.Complex> log $ (-1/0) :+ (-1/0)
 Infinity :+ NaN

 Prelude Data.Complex> exp $ 1/0 :+ 1
 Infinity :+ Infinity
 Prelude Data.Complex> exp $ 1/0 :+ 0
 Infinity :+ NaN
 Prelude Data.Complex> exp $ (-1/0) :+ 0
 0.0 :+ 0.0
 }}}
 But (!**) can not raise to infinity:
 {{{
 Prelude Data.Complex> 2 ** (1/0 :+ 1)
 NaN :+ NaN
 Prelude Data.Complex> 2 ** (1/0 :+ 0)
 NaN :+ NaN
 Prelude Data.Complex> 2 ** ((-1/0) :+ 0)
 NaN :+ NaN
 }}}
 Is it need to be fixed too?

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


More information about the ghc-tickets mailing list