Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor clarification on allowed rounding mode #830

Open
hpkfft opened this issue Jul 31, 2024 · 1 comment
Open

Minor clarification on allowed rounding mode #830

hpkfft opened this issue Jul 31, 2024 · 1 comment
Labels
Maintenance Bug fix, typo fix, or general maintenance. Narrative Content Narrative documentation content.
Milestone

Comments

@hpkfft
Copy link
Contributor

hpkfft commented Jul 31, 2024

The accuracy section of this standard states

The results of element-wise arithmetic operations ...
for floating-point operands must return the nearest representable value
according to IEEE 754-2019 and a supported rounding mode.

I believe this intends to allow (optionally, and not by default) the use of directed rounding, i.e., the IEEE 754-2019 rounding attributes roundTowardPositive, roundTowardNegative, and roundTowardZero.
However, directed rounding does not, in general, return the nearest representable value--only an attribute that rounds to nearest does that.
IEEE 754-2019 defines the term "correctly rounded", which I suggest is preferred here:

The results of element-wise arithmetic operations ...
for floating-point operands must return the correctly rounded value
according to IEEE 754-2019 and a supported rounding mode.
@hpkfft
Copy link
Contributor Author

hpkfft commented Jul 31, 2024

By the way, I would support a recommendation that array libraries offer directed rounding as an option.
One way to try to assess the effects of roundoff upon a floating-point computation is to repeat the computation in arithmetic of the same precision but rounded differently, say TowardNegative, TowardPositive, and maybe TowardZero, besides "to nearest", and compare three or four results. I'm quoting Prof. W. Kahan.

Though far from foolproof, rounding every inexact arithmetic operation (but not constants)
in the same direction for each of two or three directions besides the default "to nearest"
is very likely to confirm accidentally exposed hypersensitivity to roundoff.
When feasible, this scheme offers the best Benefit/Cost ratio [of the five he mentions].

The paper is Mindless.pdf.

@kgryte kgryte added this to the v2024 milestone Aug 1, 2024
@kgryte kgryte added Maintenance Bug fix, typo fix, or general maintenance. Narrative Content Narrative documentation content. labels Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance Bug fix, typo fix, or general maintenance. Narrative Content Narrative documentation content.
Projects
None yet
Development

No branches or pull requests

2 participants