JSON-Schema-Test-Suite icon indicating copy to clipboard operation
JSON-Schema-Test-Suite copied to clipboard

more multipleOf and overflow tests, consolidated into optional/

Open karenetheridge opened this issue 3 years ago • 8 comments
trafficstars

More argument combinations for multipleOf, including floats that will be treated as integers, as these might be internally represented as floats rather than ints, and therefore may behave differently.

All tests that might overflow (i.e. with very large/small numbers or a high number of significant digits) are consolidated into optional/ as an error may not be treated the same as valid: false.

karenetheridge avatar Dec 30 '21 19:12 karenetheridge

closes #534.

karenetheridge avatar Dec 30 '21 19:12 karenetheridge

I've tested these on drafts 2020-12, 2019-09 and 7; if someone else with support could check them on draft6 and draft4 that would be great.

karenetheridge avatar Dec 30 '21 19:12 karenetheridge

(Thanks!)

I'm not sure how I feel about fully combining these yet personally.

There are 2 distinct pieces here to me --

  • whether your implementation uses bignums (for integral values)
  • whether your implementation supports infinite precision fixed-or-floating point values

JSON only has numbers, but many languages (mine, Python one of them) uses floats for JSON numbers with decimals, and ints for ones without. Which means I support (by default) bignum but not infinite precision floats. I think that will not be uncommon -- so personally I'd probably lean towards splitting these tests into two separate optional files rather than just the one.

Opinions welcome from others though.

Julian avatar Jan 04 '22 08:01 Julian

I'm happy either way. My main concern was putting both cases into optional, which is being addressed, so 👍

gregsdennis avatar Jan 04 '22 12:01 gregsdennis

JSON only has numbers, but many languages (mine, Python one of them) uses floats for JSON numbers with decimals, and ints for ones without. Which means I support (by default) bignum but not infinite precision floats.

I'm not following your logic here. You would need bignums for high precision calculations, whether that's with integers or floats. e.g. for a calculation like 1e+308 / 0.123456789, both the arguments can be represented with native-architecture floats, but the calculation itself requires a high degree of precision in order to determine if the remainder is zero.

karenetheridge avatar Jan 09 '22 00:01 karenetheridge

I'm talking about tests like this: https://github.com/json-schema-org/JSON-Schema-Test-Suite/pull/538/files#diff-3070fe12dfc9ffeaf3ec0a633efce5b08f5cd07358f512904e3ffdb8f0b5103eR76-R95

That test mixes two unrelated concepts -- 18446744073709551600 passes if your implementation uses bigintegers. 18446744073709551600.0 requires the use of non-IEEE floats. An implementation may support one and not the other. And I was saying it's easier to deal with that if we have the two concepts separated.

Julian avatar Jan 09 '22 06:01 Julian

ok, I see. I can split the tests back out.

karenetheridge avatar Jan 09 '22 23:01 karenetheridge

@karenetheridge any chance you're still up for splitting the above?

Julian avatar Jun 15 '22 20:06 Julian