Re: [GHC] #2076: rational infinities don't compare correctly to each other
#2076: rational infinities don't compare correctly to each other ---+ Reporter: uhollerbach | Owner: jeffrey Type: bug | Status: closed Priority: normal| Milestone: _|_ Component: libraries/base|Version: 6.8.2 Resolution: wontfix | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase:| Blockedby: Blocking:|Related: ---+ Changes (by simonmar): * status: new = closed * resolution: = wontfix Comment: Lots of good discussion on this subject in #3676. I think we concluded that `Rational` does not include infinity as a value. Based on that, and the fact that `1%0` is actually `_|_`, I'm closing this ticket. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2076#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2076: rational infinities don't compare correctly to each other
#2076: rational infinities don't compare correctly to each other -+-- Reporter: uhollerbach | Owner: jeffrey Type: bug | Status: new Priority: normal| Milestone: _|_ Component: libraries/base| Version: 6.8.2 Keywords:| Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown |Testcase: Blockedby:|Blocking: Related:| -+-- Comment(by jeffrey): In libraries/base/GHC/Real.lhs, I added instance (Integral a) = Ord (Ratio a) where {-# SPECIALIZE instance Ord Rational #-} + (x:%0) = (x':%0 ) = x0 || 0 x' + (x:%0) = (_ :%_ ) = x0 + (_:%_) = (x':%0 ) = 0x' (x:%y) = (x':%y') = x * y' = x' * y + (x:%0) (x':%0 ) = x0 0 x' + (x:%0) (_ :%_ ) = x0 + (_:%_) (x':%0 ) = 0x' (x:%y) (x':%y') = x * y' x' * y which passes my testsuite for this bug. However, I also tested the equivalence of same-sign infinities (which I assumed to be a desired property when I wrote the code) and found that it wasn't working; for example Prelude GHC.Real (2:%0) == (1:%0) False When I also found that, for example, Prelude GHC.Real (2:%4) == (1:%2) False I figured that (:%) wasn't intended to equate different forms of actually- equal ratios. So I figured my proposed bug fix would just introduce another bug, since it, for example, yields Prelude GHC.Real (2:%0) (1:%0) -- should be False False Prelude GHC.Real (2:%0) = (1:%0) True which contradicts the non-equality observed above. But then I tried Prelude GHC.Real compare (2:%4) (1:%2) LT Prelude GHC.Real (2:%4) (1:%2) False which doesn't make sense(?), and figured I'm probably missing the bigger picture here. Thoughts? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2076#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2076: rational infinities don't compare correctly to each other
#2076: rational infinities don't compare correctly to each other -+-- Reporter: uhollerbach | Owner: jeffrey Type: bug | Status: new Priority: normal| Milestone: _|_ Component: libraries/base| Version: 6.8.2 Keywords:| Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown |Testcase: Blockedby:|Blocking: Related:| -+-- Comment(by jeffrey): In libraries/base/GHC/Real.lhs, I added {{{ instance (Integral a) = Ord (Ratio a) where {-# SPECIALIZE instance Ord Rational #-} + (x:%0) = (x':%0 ) = x0 || 0 x' + (x:%0) = (_ :%_ ) = x0 + (_:%_) = (x':%0 ) = 0x' (x:%y) = (x':%y') = x * y' = x' * y + (x:%0) (x':%0 ) = x0 0 x' + (x:%0) (_ :%_ ) = x0 + (_:%_) (x':%0 ) = 0x' (x:%y) (x':%y') = x * y' x' * y }}} which passes my testsuite for this bug. However, I also tested the equivalence of same-sign infinities (which I assumed to be a desired property when I wrote the code) and found that it wasn't working; for example {{{ Prelude GHC.Real (2:%0) == (1:%0) False }}} When I also found that, for example, {{{ Prelude GHC.Real (2:%4) == (1:%2) False }}} I figured that (:%) wasn't intended to equate different forms of actually- equal ratios. So I figured my proposed bug fix would just introduce another bug, since it, for example, yields {{{ Prelude GHC.Real (2:%0) (1:%0) -- should be False False Prelude GHC.Real (2:%0) = (1:%0) True }}} which contradicts the non-equality observed above. But then I tried {{{ Prelude GHC.Real compare (2:%4) (1:%2) LT Prelude GHC.Real (2:%4) (1:%2) False }}} which doesn't make sense(?), and figured I'm probably missing the bigger picture here. Thoughts? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2076#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2076: rational infinities don't compare correctly to each other
#2076: rational infinities don't compare correctly to each other -+-- Reporter: uhollerbach | Owner: jeffrey Type: bug | Status: new Priority: normal| Milestone: _|_ Component: libraries/base| Version: 6.8.2 Keywords:| Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown |Testcase: Blockedby:|Blocking: Related:| -+-- Changes (by jeffrey): * cc: jeffreyjthornton@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2076#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2076: rational infinities don't compare correctly to each other
#2076: rational infinities don't compare correctly to each other -+-- Reporter: uhollerbach | Owner: jeffrey Type: bug | Status: new Priority: normal| Milestone: _|_ Component: libraries/base| Version: 6.8.2 Keywords:| Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown |Testcase: Blockedby:|Blocking: Related:| -+-- Changes (by jeffrey): * owner: = jeffrey * failure: = None/Unknown -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2076#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs