[📝 Docs]: Erroneous example for multipleOf
#1113
Labels
📝 Documentation
Indicates improvements or additions to documentation.
good first issue
Good for newcomers
Status: Available
No one has claimed responsibility for resolving this issue.
What Docs changes are you proposing?
The spec of json-schema says that a number
x
satisfies amultipleOf: m
schema when the result ofx / m
is an integer/ However, in most programming languages, the floating-point numbers are conforming to the ieee754 standard, more precisely, to its binary floating-point specification. In that case, 4.02 is not a multiple of 0.01 (as can be seen in python wherefloat(402) == 4.02 / 0.01
returnsFalse
).The example should be updated to be valid in most programming languages and specify that floating-point multiples are not what they appear to be. For example, 4.2 is a multple of 0.05 according to the spec and when doing the computation in binary floating-points.
Code of Conduct
The text was updated successfully, but these errors were encountered: