Description
Spec for step constraint validation says:
Constraint validation: When the element has an allowed value step, and the result of applying the algorithm to convert a string to a number to the string given by the element's value is a number, and that number subtracted from the step base is not an integral multiple of the allowed value step, the element is suffering from a step mismatch.
input[type=number]
's algorithm to convert a string to a number follows rules for parsing floating-point number values which specifically mention rounding to IEEE 754 double-precision float:
- Conversion: Let S be the set of finite IEEE 754 double-precision floating-point values except −0, but with two special values added: 2^1024 and −2^1024.
- Let rounded-value be the number in S that is closest to value, selecting the number with an even significand if there are two equally close values. (The two special values 2^1024 and −2^1024 are considered to have even significands for this purpose.)
- If rounded-value is 2^1024 or −2^1024, return an error.
- Return rounded-value.
step
attribute value is also parsed using these steps. It implies that step mismatch check should check if one base-2 floating-point number is exact integer multiple of another, which doesn't make much sense in practice.
Firefox and Chrome use decimal floating-point numbers instead to avoid rounding.