-
Notifications
You must be signed in to change notification settings - Fork 456
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
[interpreter] rounding for floating-point constants #809
Comments
@sunfishcode, does the above merge close this issue? |
@ericprud No, this issue was added as a result of discussion on that PR. It's still a problem, but it's a minor one as it only affects how some floats are interpreted in the text format when given extra precision. It's perhaps not even an issue with the spec, but with the reference interpreter (and other tools). The spec clearly says that the value should be treated as infinite precision then rounded to the nearest (non-infinite) value, see http://webassembly.github.io/spec/core/text/values.html#floating-point. |
Parsing float literals via f64 exhibits a double rounding issue similar to the one from #421. Incorrect rounding to infinity is just one case. #1025 adds various test cases, plus a gross hack to the interpreter to correct double rounding errors when parsing small floats (unfortunately, we cannot use a fix as simple as in #1021). PTAL |
This fixes issue reported here WebAssembly/spec#809
The interpreter currently rejects
(f32.const 0x1.fffffefffffff8000000p127)
, because it rounds the value up, out of the finite range off32
. Ideally, floating-point literals should be interpreter as if they were floating-point values with infinite precision, and then rounded in a single step to the expression type.See also the background discussion here.
The text was updated successfully, but these errors were encountered: