erkokl at gmail.com
Mon Sep 18 00:48:44 UTC 2017
Looks like you're raising the same concern as in here:
Long story short: You cannot encode -0.0 directly. You have to represent it
as an expression, multiplying `-1` with `fromRational 0`.
Similar concerns apply to NaN and Infinity as well, though those cannot be
written as literals to start with, so it isn't a big issue there.
On Sun, Sep 17, 2017 at 7:02 AM, Moritz Angermann <
moritz.angermann at gmail.com> wrote:
> Hi *,
> I just ran into the following case:
> > fromRat (-0 :: Rational) :: Double
> > -0 :: Rational
> 0 % 1
> How do I encode negative zero as a rational? The question come
> up as `CmmFloat` is defined as `CmmFloat Rational Width` in
> compiler/cmm/CmmExpr.hs. And my code generator thus turned
> (Int, Rational) into a floating point expression, and when trying
> to turn it into a `double` value, I ended up getting bad negative
> This makes me believe I can’t actually encode `-0` as a Rational,
> and such `CmmFloat` will never contain `-0`?
> ghc-devs mailing list
> ghc-devs at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs