Fraction Floor and Remainder
Split an exact rational into mathematical floor and a nonnegative reduced fractional remainder; signed numerators are not truncated toward zero.
Description
Split an exact rational into mathematical floor and a nonnegative reduced fractional remainder; signed numerators are not truncated toward zero.
Floor decomposition represents a fraction as an integer plus a nonnegative proper remainder, including for negative inputs.
When to use this tool
Split an exact rational into mathematical floor and a nonnegative reduced fractional remainder; signed numerators are not truncated toward zero.
- Prepare the supplied numerator, denominator fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter numerator, denominator. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.floor, result.remainder. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Normalize n/d, calculate mathematical floor rather than truncation, and return floor plus reduced remainder (n minus floor*d)/d.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| numerator | Exact signed decimal integer text; denominator fields must be nonzero. | Optional + or - and 1 to 256 decimal digits |
| denominator | Exact signed decimal integer text; denominator fields must be nonzero. | Optional + or - and 1 to 256 decimal digits |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.floor | The floor value under the stated formula or text convention. |
| result.remainder | The remainder value under the stated formula or text convention. |
{
"input": {
"numerator": "-7",
"denominator": "3"
},
"output": {
"result": {
"floor": "-3",
"remainder": {
"numerator": "2",
"denominator": "3"
}
}
}
} Limitations and assumptions
- The remainder is in [0, 1). It is not a sign-preserving truncated remainder or a decimal approximation.
- Numerator and denominator fields use exact decimal integer strings of at most 256 digits with an optional sign. Fractions are reduced with a positive denominator before the stated operation.
- All declared input fields are required and unexpected top-level fields are rejected. Numbers must be finite; lists are limited to 128 entries and ordinary text fields to 8,192 UTF-16 code units, with tighter limits where stated.
- JSON text inputs must parse within bounded nesting and size limits. Numeric outputs outside the safe finite range are rejected; large exact integer results use decimal strings. Indexes and half-open spans are zero-based unless a rank is explicitly described as one-based.
Alternative or Complementary methods
Use exact numerator/denominator operations when equality and boundary decisions matter. Convert to a decimal display only with an explicit rounding policy; a rounded display should not replace the exact result.
References
Similar or alternative tools
- Fraction Between Integer Bounds
Check exact rational membership in caller-supplied inclusive integer bounds without decimal approximation.
- Fraction Nearest Integer Tie Policy
Round an exact fraction to a nearest integer with explicit half-even, away-from-zero or positive-infinity tie policy.