You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Instance validates if multipleOf is an integer, but fails if it's a float #1159
Needs thinking though / reading the spec language. It's true the spec says to treat floats with no fractional part as integers, but it also says (or really leaves the JSON spec to say) that floats are an acceptable implementation of number -- and I'm not sure where if anywhere covers what the requirements are on coercion to a common type.
Specifically here, 9007199254740995 is not representable as a float, the closest float is 9007199254740996.0 which is indeed not divisible by 11, so doing the division somehow will require coercing to float.
But it's possible you're both correct on whether this is covered by the spec and also possible this is fixable, not sure, needs thinking.
Both passed on older versions of jsonschema, so for whatever it's worth this probably changed in version 4.18. I've just skipped the affected test though, and happy to go with your opinion 👍
On Sun, Sep 10, 2023, 19:27 Zac Hatfield-Dodds ***@***.***> wrote:
Both passed on older versions of jsonschema, so for whatever it's worth
this probably changed in version 4.18. I've just skipped the affected test
though, and happy to go with your opinion 👍
—
Reply to this email directly, view it on GitHub
<#1159 (comment)>,
or unsubscribe
<http://github.com/notifications/unsubscribe-auth/AACQQXWKRVOUYR6GRW3MERDXZZEHZANCNFSM6AAAAAA4SOQ2YY>
.
You are receiving this because you commented.Message ID:
***@***.***>
Activity
Julian commentedon Sep 10, 2023
Nice :)
Needs thinking though / reading the spec language. It's true the spec says to treat floats with no fractional part as integers, but it also says (or really leaves the JSON spec to say) that floats are an acceptable implementation of number -- and I'm not sure where if anywhere covers what the requirements are on coercion to a common type.
Specifically here, 9007199254740995 is not representable as a float, the closest float is 9007199254740996.0 which is indeed not divisible by 11, so doing the division somehow will require coercing to float.
But it's possible you're both correct on whether this is covered by the spec and also possible this is fixable, not sure, needs thinking.
Zac-HD commentedon Sep 10, 2023
Both passed on older versions of
jsonschema, so for whatever it's worth this probably changed in version 4.18. I've just skipped the affected test though, and happy to go with your opinion 👍Julian commentedon Sep 10, 2023
IronAlpha3528 commentedon Jan 21, 2026
IronAlpha3528 commentedon Jan 22, 2026
Fix multipleOf with integer-valued float failing for large integers