min/max/step Number Input Semantics
Checks parsed number-input min/max and step constraints using exact decimal arithmetic on the canonical decimal spelling of supplied finite numbers. Supply normalized positive step (default 1) and attribute presence flags; this is an ideal decimal model, independent of browser binary floating point tolerances.
Description
Number input constraints combine range bounds with an arithmetic step grid.
Number input constraints combine range bounds with an arithmetic step grid. The step base comes from min first, then the value attribute, then zero.1
Checks parsed number-input min/max and step constraints using exact decimal arithmetic on the canonical decimal spelling of supplied finite numbers. Supply normalized positive step (default 1) and attribute presence flags; this is an ideal decimal model, independent of browser binary floating point tolerances.
When to use min/max/step Number Input Semantics
Use this for the following task: Checks parsed number-input min/max and step constraints using exact decimal arithmetic on the canonical decimal spelling of supplied finite numbers. Supply normalized positive step (default 1) and attribute presence flags; this is an ideal decimal model, independent of browser binary floating point tolerances.
Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
How to use min/max/step Number Input Semantics and understand its results
- Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
- Enter value, hasMin, min, hasMax, max, stepAny, step, hasValueAttribute, valueAttribute using the field table, then run the tool.
- Read rangeUnderflow, rangeOverflow, stepMismatch, stepBase. Interpret flags, units, ordering and placeholder values using the rules below.
- Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| value | Value | number | Required |
| hasMin | Has Min | boolean | Required |
| min | Min | number | Required |
| hasMax | Has Max | boolean | Required |
| max | Max | number | Required |
| stepAny | Step Any | boolean | Required |
| step | Step | number; minimum 0 | Required |
| hasValueAttribute | Has Value Attribute | boolean | Required |
| valueAttribute | Value Attribute | number | Required |
Supply finite parsed numbers, normalized positive step and attribute-presence flags. Convert canonical decimal spellings into scaled integers for exact step divisibility. Range checks use only present min/max.2
stepMismatch = !stepAny AND (value − stepBase) is not an integer multiple of step This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.
| Output field | Meaning | Value type |
|---|---|---|
| rangeUnderflow | Range Underflow | boolean |
| rangeOverflow | Range Overflow | boolean |
| stepMismatch | Step Mismatch | boolean |
| stepBase | Step Base | number |
{
"input": {
"value": 0.3,
"hasMin": true,
"min": 0.1,
"hasMax": true,
"max": 1,
"stepAny": false,
"step": 0.2,
"hasValueAttribute": false,
"valueAttribute": 0
},
"output": {
"rangeUnderflow": false,
"rangeOverflow": false,
"stepMismatch": false,
"stepBase": 0.1
}
} Limitations and assumptions
This is an ideal decimal model; browser floating-point tolerances can differ. A positive step remains required even with stepAny true.
This evaluates supplied local information; it does not fetch a page or run a browser. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.
Alternative or Complementary methods
Choose required/readonly/disabled Diff Table for this operation: Resolves required, readonly and disabled flags for an ordinary input type. Effective disabled includes inherited fieldset state supplied by the caller. Submission eligibility concerns disabling only; name, checkedness and submitter selection are separate. For a complementary task, use textarea/input maxlength Parity for this operation: Measures an input or textarea API value in UTF-16 code units against maxlength. Supply the already-normalized API value; this does not model user-edit constraint-validation conditions or grapheme counts.
Further background: HTML / accessibility reference: min/max/step Number Input Semantics.
References
Similar or alternative tools
- required/readonly/disabled Diff Table
Resolves required, readonly and disabled flags for an ordinary input type. Effective disabled includes inherited fieldset state supplied by the caller. Submission eligibility concerns disabling only; name, checkedness and submitter selection are separate.
- textarea/input maxlength Parity
Measures an input or textarea API value in UTF-16 code units against maxlength. Supply the already-normalized API value; this does not model user-edit constraint-validation conditions or grapheme counts.