Fraction Mediant Pair
Exact rational mediant of canonical positive-denominator pairs using decimal integer text and coprime output; no IEEE-754 precision loss.
Description
Exact rational mediant of canonical positive-denominator pairs using decimal integer text and coprime output; no IEEE-754 precision loss.
The mediant adds numerators and denominators separately. It is a distinct operation from fraction addition or an arithmetic average.
When to use this tool
Exact rational mediant of canonical positive-denominator pairs using decimal integer text and coprime output; no IEEE-754 precision loss.
- Prepare the supplied leftNumerator, leftDenominator, rightNumerator, rightDenominator 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 leftNumerator, leftDenominator, rightNumerator, rightDenominator. 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.numerator, result.denominator. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Reduce both inputs with positive denominators, form (a plus c)/(b plus d), then reduce the result.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| leftNumerator | Exact signed decimal integer text; denominator fields must be nonzero. | Optional + or - and 1 to 256 decimal digits |
| leftDenominator | Exact signed decimal integer text; denominator fields must be nonzero. | Optional + or - and 1 to 256 decimal digits |
| rightNumerator | Exact signed decimal integer text; denominator fields must be nonzero. | Optional + or - and 1 to 256 decimal digits |
| rightDenominator | 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.numerator | Reduced signed numerator as decimal integer text. |
| result.denominator | Positive denominator as decimal integer text, under the normalization or common-denominator convention above. |
{
"input": {
"leftNumerator": "2",
"leftDenominator": "3",
"rightNumerator": "1",
"rightDenominator": "6"
},
"output": {
"result": {
"numerator": "1",
"denominator": "3"
}
}
} Limitations and assumptions
- Because inputs are normalized first, equivalent unreduced spellings yield this canonical-input mediant. It may differ from a mediant formed directly from original written pairs.
- 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
- Canonical Fraction Pair
Canonicalize an exact integer fraction into coprime numerator and positive denominator text; zero denominator is rejected.
- Fraction Reciprocal Pair
Return the exact reciprocal of a nonzero rational in canonical integer text; zero reciprocal is rejected.