Open
Description
I notice you already have implementation of algorithms like 2Sum
in fp-ieee
. Would it make sense to add a backend to rounded-hw
which uses these to compute addition of intervals, instead of relying on switching floating-point register rounding modes (which can be slow)?
I'm adding fused multiply-add to GHC in GHC MR !9996. WIth that, we can also do something like:
prod :: Double -> Double -> ( Double, Double )
prod a b =
let !p = a * b
!e = fmsub a b p
in case compare e 0 of
LT -> ( nextDown p, p )
EQ -> ( p, p )
GT -> ( p, nextUp p )
I'd be interested to see the benchmarks to compare the approaches.
Metadata
Metadata
Assignees
Labels
No labels