-
Notifications
You must be signed in to change notification settings - Fork 457
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
Asserts for floating point tests #70
Comments
I'd suggest simply changing the implementation of As for NaN tests, it is easy to express that in WASM itself, so I don't think we need to extend the assertion language just for that either. |
Btw, once your new float implementations land, |
You're right; there is no need for the looser equality in our tests. It just feels weird to me to give As for NaN tests, it seems like it will be quite inconvenient to express any-NaN tests in terms of assert_eq regardless of whether it's the strict or loose version. The strict one tests for a specific bit pattern when we want to accept many, and the loose version requires we name the value so that we can reference it twice and form |
BTW, you're right that = and <> now automatically do bitwise equality with my float implementations. How does that work, given that the types are abstract? |
Ah, I found a blog post which explains it. |
Agreed with what I think @rossberg-chromium is saying on NaNs: this should be done with a wasm function, e.g.: |
In Ocaml, equality is generic, and does the "right" thing depending on the That actually is quite a dubious semantics, given that IEEE defines a |
Ok, I now have an implementation of https://github.com/WebAssembly/spec/tree/float-tests It's still experimental (the final version may not actually want to weigh in at 17 MiB of tests, etc.) but I think this demonstrates some nice properties of
What do people think? |
#81 implements this and is now merged. |
* Remove irrelevant comment * Support node.js as well
We decided to change the event section code from 12 to 13 in WebAssembly#70 as the new DataCount section in the bulk memory operations proposal will take the code 12 instead.
Use `unsigned long long` rather then `unsigned long` which gives us u64 range rather than u32 range. See https://webidl.spec.whatwg.org/#idl-unsigned-long-long
assert_eq
uses ocaml's <> which returns false for-0 <> 0
and true forNaN <> x
∀x. This is the usual behavior, but for our floating point unit tests we have unusual needs: we do actually need to distinguish between -0 and 0, test for specific NaNs sometimes, and test for any NaN sometimes. What do people think of adding the following?assert_eq_bits
- likeassert_eq
, but reinterpret-casts both operands as same-size integers firstassert_nan
- has one operand and asserts that it is a NaN (of any kind)The text was updated successfully, but these errors were encountered: