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

GHC ghc-devs at haskell.org
Tue Apr 29 04:16:08 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):

 > We can also add special case for raising to 1 to increase accuracy
 > But I'm not so sure.
 Special cases are not just messy code; they produce messy values. I've
 seen an explanation from a numerical analyst that they need a function
 that's mathematically monotonic, such as log, to be numerically monotonic
 when computed. It's hard to guarantee smooth computational behavior if
 special cases are thrown in, in order to gain perfect accuracy.

 In my opinion it would be better to leave
 {{{
 x ** y         =  exp (log x * y)
 }}}
 in effect, except when x is 0 or infinite.

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


More information about the ghc-tickets mailing list