Skip to content

Interval arithmetic backend that doesn't set rounding modes? #3

Description

@sheaf

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions