[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Switch rounding mode
From: |
Jason Riedy |
Subject: |
Re: Switch rounding mode |
Date: |
Sat, 18 Apr 2009 01:39:03 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) |
Przemek Klosowski a écrit :
> If you prefer another example [c]=[a]+[b]
> > c.min = a.min \+/ b.min
> > c.max = a.max /+\ b.max
>
> \+/ and /+\ are + operator with rounding downward for the first and
> upward for the second.
I recommend looking into Siegfried Rump's INTLAB for Matlab™ [1],
and also some of his relevant publications.
Note that IEEE-754 rounding modes sometimes are ignored by
compilers; and sometimes the C99 functions are there but they don't
actually do anything. It's really, really annoying…
There is a somewhat portable option that may or may not be slower
(depending on the platform). All operations have a form with an
error representation. The two you picked just happen to be "easy".
A doubled double representation will produce a result + an error,
and you can use that error to round the result appropriately.
Multiplication and division are a little different but possible.
See Rump's pubs on "error free transformations" and accurate dot
products; you'll definitely want the latter for some matrix
operations. Another handy reference is Bailey, Hida, et al.'s
quad-double [2] and higher precision implementations [3].
Note that some interval algorithms for "simple" problems like
solving Ax=b for the smallest enclosure x are NP-hard… Don't get
your hopes too high for interval work. Intervals tell you when you
might have a problem, but they don't necessarily help you find a
better answer without further analysis.
I have a really, really bad doubled-double implementation using
Octave's new object support. Mail me if you want it, but you'd be
better off working from scratch.
Jason
Footnotes:
[1] http://www.ti3.tu-harburg.de/rump/intlab/
[2] http://www.cs.berkeley.edu/~yozo/papers/LBNL-46996.ps.gz
[3] http://crd.lbl.gov/~dhbailey/mpdist/