bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] MPFR rounding issue


From: Andrew J. Schorr
Subject: Re: [bug-gawk] MPFR rounding issue
Date: Tue, 21 Nov 2017 09:29:05 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Tue, Nov 21, 2017 at 10:31:11AM +0100, David Kaspar [Dee'Kej] wrote:
> The only difference is when the MPFR is used - it provides different result
> compared to when -M is not supplied.

That's because the user has explicitly selected a non-standard rounding mode
for the MPFR calculations. If he didn't want strange results, he shouldn't
have set ROUNDMODE to "A".

> But again - you're using what the
> library returns. If you would update the documentation, that should be IMHO
> enough. :)

Agreed.

> To answer your question, Andy, I think you're looking for this (from IEEE
> 754):
> 
> 4.3.1 Rounding-direction attributes to nearest
> 
> ― roundTiesToAway, the floating-point number nearest to the infinitely
> precise result shall be
> delivered; if the two nearest floating-point numbers bracketing an
> unrepresentable infinitely
> precise result are equally near, the one with larger magnitude shall be
> delivered.

That's what we had before, but it doesn't describe the behavior of MPFR_RNDA.

> For example, the GLIBC doesn't even have that mode for rounding, if I read
> it correctly. However, I guess it wouldn't hurt to use something like
> 'roundAwayFromZero', just as a derivative.

This is precisely my question: is this an actual IEEE rounding mode, or just
something that the MPFR folks invented? In the gawk docs, the rounding mode
table includes an "IEEE name" column, but I can't find an official name for
this rounding mode. I don't think we should fabricate one, since that could
lead to more confusion.

Thanks,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]