[GHC] #9251: ghc does not expose branchless max/min operations as primops

GHC ghc-devs at haskell.org
Sun Jul 6 20:42:27 UTC 2014


#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 arotenberg):

 Yeah, I've seen those slides before. The problem with the arguments
 presented is that I know there is a class of users who demands
 "linguistically-legislated exact reproducibility" for floating-point
 computations, because I'm part of it! For my day job, I use Java to write
 a tool for modeling safety-critical software systems on desktop hardware.
 For our purposes, it is ''far'' more important that the results of the
 simulation be exactly identical across different platforms than it is they
 be numerically accurate or efficiently computable. We use Java's
 `strictfp` keyword and `StrictMath` class ubiquitously in our simulation
 engine, because it is essential that the output of our program be
 identical, no matter where or when it is run. When it is necessary to
 compute different or more numerically-accurate floating-point outputs, we
 emulate it in software. This is slow but allows us 100% confidence that
 you will always get the same results.

 That said, our application is a rare case. In most situations, faster and
 more accurate computations that can give slightly different results on
 different machines are preferable to calculations that are wrong in
 exactly-reproducible ways.

 Which section (if any) of the Haskell 2010 Report specifies the behavior
 of floating-point operations? I've glanced through it quickly but all I've
 been able to find is
 [https://www.haskell.org/onlinereport/haskell2010/haskellch9.html#x16-1710009
 the Prelude definitions of the instances for Float and Double], which just
 list them as primitives.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9251#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list