#4413: (^^) is not correct for Double and Float
----------------------------------+-----------------------------------------
Reporter: daniel.is.fischer | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/base
Version: 7.1 | Keywords: Double, Float, exponentiation
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: Incorrect result at runtime
----------------------------------+-----------------------------------------
Consider
{{{
Prelude> 2 ^^ (-1024)
0.0
Prelude> 0.5 ^^ 1024
5.562684646268003e-309
}}}
The cause is
{{{
x ^^ n = if n >= 0 then x^n else recip (x^(negate n))
}}}
If we change it to
{{{
x ^^ n = if n >= 0 then x^n else ((recip x)^(negate n))
}}}
it'll do the right thing for Double and Float, and I don't know of any
type where it would produce incorrect results.
Does it need a library proposal or can the change be made without?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4413>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs