fix: move bignum-dependent multipleOf tests to optional/bignum.json#866
Conversation
Signed-off-by: Sagar-6203620715 <sagar6203620715@gmail.com>
|
/cc @Julian |
|
Are we sure this is necessary? Most implementations don't support bignum and if this was a problem, someone would have said something by now. I know my implementation passes these tests and doesn't have bignum support. |
|
Hi @jdesrosiers Thanks for the review, for the "float division = inf" case: an implementation without bignum may return for the "small multiple of large integer" case ( so the concern isn't that implementations can't pass these, it's that they can pass them through platform-specific coincidences rather than correct evaluation. This was also the consensus reached in #536, @Julian @gregsdennis all agreed these belong in optional, and @Julian explicitly invited a PR to move them. Happy to discuss further if you see it differently! |
I agree that implementations shouldn't catch overflows and report them as false, but that's not necessary for these tests.
Floating point math can have issues even with simple numbers ( |
|
@jdesrosiers I verified the arithmetic, and it seems your reasoning is correct. For For small multiple of large integer: I've confirmed , Happy to close this if you're satisfied the tests are correctly placed as required. Also I think the issue #536 may be closed. |
|
Actually, there is something to be done here. The description of the first test, ("always invalid, but naive implementations may raise an overflow error") is not correct and it would be great if we could fix that. No overflow should be expected. |
What this changes
Two test groups in the core
multipleOf.jsonfiles require arbitrary-precision arithmetic to evaluate correctly, making them de-facto mandatory bignum tests. This violates the suite's own convention that bignum support is optional.The two affected test groups, moved across all 6 drafts:
"float division = inf"— validates1e308againstmultipleOf: 0.123456789, expectsvalid: false. Assumes implementations overflow tofalserather than erroring/throwing, which is not guaranteed on all platforms."small multiple of large integer"— validates12391239123againstmultipleOf: 1e-8, expectsvalid: true. Requires arbitrary-precision arithmetic to compute correctly; IEEE 754 double implementations will silently produce a wrong result.Files modified
Each
multipleOf.jsonretains exactly 3 test groups:"by int","by number", and"by small number"— none of which require bignum support.Notes
$schemaURIs are preserved exactly as they appeared in the originalmultipleOf.jsonfiles (draft4/6/7 have no$schema; 2019-09, 2020-12, and v1 retain their respective URIs)."invalid, but naive..."vs"always invalid, but naive..."in later drafts) is intentionally preserved.Fixes #536