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

GHC ghc-devs at haskell.org
Wed Apr 30 10:33:00 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):

 Replying to [comment:21 Scott Turner]:
 > > NaN!**0 :: Double equals 1 too.
 > See [http://wikipedia.org/wiki/NaN#Signaling_NaN] for an exception to
 that. The same Wikipedia article has interesting things to say about 0!**0
 and infinity!**0 also.
 Interesting. It says:
 > The 2008 version of the IEEE 754 standard says that pow(1,qNaN) and
 pow(qNaN,0) should both return 1 since they return 1 whatever else is used
 instead of quiet NaN.
 Should we add another definition?
 {{{
 (1:+0) ** _ = 1:+0
 }}}
 To fix this:
 {{{
 Prelude Data.Complex> 1 ** (0/0) :: Double
 1.0
 Prelude Data.Complex> 1 ** (0/0) :: Complex Double
 NaN :+ NaN
 }}}

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


More information about the ghc-tickets mailing list