
#9251: ghc does not expose branchless max/min operations as primops -------------------------------------+------------------------------------ Reporter: carter | Owner: carter Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: #9246 -------------------------------------+------------------------------------ Comment (by carter): actually, importantly, in section 5.11 of the 2008 standard they say Four mutually exclusive relations are possible: **less than** , **equal**, **greater than**, and **unordered**. The last case arises when at least one operand is NaN. Every NaN shall compare unordered with everything, including itself. Comparisons shall ignore the sign of zero (so +0 = −0). Infinite operands of the same sign shall compare equal. thus the Ord compare based instance should actually perhaps throw an exception or otherwise fail when either argument is Nan? I'll need read a bit more. ANYWAY, theres several *distinct* semantics that can be chosen, and adding suitable support to ghc for the different semantics that aren't interexpressible is something I'll spend some time thinking about. don't worry, you'll have the version you want, but there will be an IEEE compliant one that also satisfies the corresponding haskell standard (BOTH, if they disagree theres a serious problem i'll have to have some discussion about) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9251#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler