-
Notifications
You must be signed in to change notification settings - Fork 280
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
Fix Float::copysign impl #293
Conversation
Codecov Report
@@ Coverage Diff @@
## master #293 +/- ##
==========================================
+ Coverage 80.00% 80.02% +0.01%
==========================================
Files 30 30
Lines 4672 4676 +4
==========================================
+ Hits 3738 3742 +4
Misses 934 934
Continue to review full report at Codecov.
|
Shouldn't we fix this first then? To make sure that this does not brake other things. |
The |
This code is used by |
yes, |
This fixes a bug recently found on oss-fuzz which was fixed in wasmi-labs/wasmi#295 and wasmi-labs/wasmi#293.
This fixes a bug recently found on oss-fuzz which was fixed in wasmi-labs/wasmi#295 and wasmi-labs/wasmi#293.
I discovered today that the official WebAssembly spec test suite assertions and
wasmi
results diverge in a particular case with thecopysign
instruction.For
F32::from_bits(0xFFFC_0000).copysign(F32::from_bits(0))
the expected result according to the WebAssembly Spec test suite is0x7FFC_0000
, however,wasmi
currently returns0xFFFC_0000
.The Rust documentation mandates the same behavior from
copysign
as WebAssembly does: https://doc.rust-lang.org/std/primitive.f32.html#method.copysignThe bug was not caught because the current
wasmi
Wasm spec test runner seems to improperly handleNaN
values.Fortunately the bug fix was easy, however, I still wonder why we are going to great lengths like this.