
#13211: NegativeLiterals -0.0 :: Double -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Keywords: newcomer | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Compare {{{ rwbarton@morphism:~$ ghc-8.0.1 -e '-0.0' -0.0 rwbarton@morphism:~$ ghc-8.0.1 -XNegativeLiterals -e '-0.0' 0.0 }}} This behavior is logical, but unexpected. The logic is that with `NegativeLiterals` the literal `-0.0` means `fromRational ((-0)%0)`, which equals `fromRational 0`, which for `Double` is positive zero, not negative zero. But this seems unfortunate. Perhaps it would be best if `-0.0` (or `-` applied to any other literal mathematically equal to zero) was desugared as `negate 0.0` even under `NegativeLiterals`, since there doesn't seem to be any other reason to write `-0.0`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13211 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler