-
Notifications
You must be signed in to change notification settings - Fork 2
multipleOf fails with some floats #12
Comments
So apparently the floating point modulus function is fucked up. It's the same in all languages I've tried. The solution is to not implement |
Sounds good. I'll disable |
P.S. I haven't made a note in the README yet, but there's a comment on the multipleOf validator that describes the situation. |
Here's how the Python jsonschema package handle's it. Does this look like a good idea: https://github.com/Julian/jsonschema/blob/master/jsonschema/_validators.py#L115 |
Yeah, that's an option. I'm entirely unconvinced that |
I found multipleOf meaningful, but the jsonschema solution is definitely not watterproof: python-jsonschema/jsonschema#185 |
Specifically it fails this test:
One thing I could do is multiple both the operator and the operand by some factor of 10 and then turn them both into integers before making the calculation. No idea if that's a good approach or not.
The text was updated successfully, but these errors were encountered: