Home My Page Projects MPFR
Summary Activity Forums Tracker Lists Tasks Docs News SCM Files

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: I would like to roundNearestTiesToAway as in IEEE [ Reply ]
By: Florian Schanda on 2016-12-08 12:25
[forum:150940]
Thanks all. I think ideally I want an MPFR_RND_IEEERNA global rounding mode. I'll revisit this when MPFR4 is out.

RE: I would like to roundNearestTiesToAway as in IEEE [ Reply ]
By: Vincent Lefèvre on 2016-12-07 15:14
[forum:150936]
FYI, MPFR 4 will have a new macro mpfr_round_nearest_away to add partial emulation of roundNearestTiesToAway, which is implemented by the solution given by Paul. AFAIK, the only issues concern underflows/overflows. This is partly solved with the macro. But if you work in a reduced exponent range, everything should be fine.

RE: I would like to roundNearestTiesToAway as in IEEE [ Reply ]
By: Paul Zimmermann on 2016-12-07 13:53
[forum:150935]
one solution is the following:

1) first round to p + 1 bits to nearest, let inexact be the corresponding ternary value
2) if inexact=0, round the previous value to p bits away from zero (RNDA)
3) otherwise, round the initial value to p bits to nearest

Paul Zimmermann

I would like to roundNearestTiesToAway as in IEEE [ Reply ]
By: Florian Schanda on 2016-12-07 13:27
[forum:150934]
... but of course MPFR_RNDA doesn't do this. Any suggestions on how to do this?