Description
Return exact numerator=a*leftWeight+c*rightWeight and denominator=b*leftWeight+d*rightWeight as decimal strings.
A rational number is represented by an integer numerator and a nonzero integer denominator. Sign placement, reduction by a greatest common divisor, and the chosen division or rounding convention affect intermediate representations. Exact integer text preserves arithmetic that could be lost in a floating-point conversion.
Return exact numerator=a*leftWeight+c*rightWeight and denominator=b*leftWeight+d*rightWeight as decimal strings.
When to use this tool
Use Rational Mediant Weighted Crosswalk when you need this particular exact fraction comparison, reduction, sign, denominator, or rounding component.
How to use the tool and how it works
- Enter leftNumerator, leftDenominator, rightNumerator, rightDenominator, leftWeight, rightWeight. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read numerator, denominator. Use the output convention below.
Parse signed decimal-integer numerators and positive denominators; require nonnegative integer leftWeight and rightWeight with positive combined weight. Return exact numerator=a*leftWeight+c*rightWeight and denominator=b*leftWeight+d*rightWeight as decimal strings.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| leftNumerator | Left Numerator | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| leftDenominator | Left Denominator | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| rightNumerator | Right Numerator | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| rightDenominator | Right Denominator | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| leftWeight | Nonnegative integer coefficient multiplying numerator and denominator. | Required. Safe integer; minimum 0. |
| rightWeight | Nonnegative integer coefficient; the pair must not both be zero. | Required. Safe integer; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| numerator | Numerator in the numeric or exact integer-text representation declared below. | Required. Text; maximum UTF-16 length 8192. |
| denominator | Denominator or exact integer denominator text under the stated sign restriction. | Required. Text; maximum UTF-16 length 8192. |
{
"input": {
"leftNumerator": "1",
"leftDenominator": "2",
"rightNumerator": "2",
"rightDenominator": "3",
"leftWeight": 1,
"rightWeight": 1
},
"output": {
"numerator": "3",
"denominator": "5"
}
} Limitations and assumptions
- This is a weighted mediant, not the ordinary weighted average of the two fraction values. Results are not reduced and denominator-weighting affects the represented value.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Reduce fractions where the interpretation requires it and choose a consistent denominator-sign and division convention. Use a complete rational operation when one denominator or determinant term is insufficient.
References
Similar or alternative tools
- Rational Mediant Denominator Budget
For positive integer firstDenominator, secondDenominator, and budget return denominator=first+second and fits when denominator<=budget.
- Continued Fraction Convergent Determinant
Parse exact decimal integers p,previousP,q,previousQ and return determinant=p*previousQ-previousP*q as text, with unimodular=true exactly for determinant +/-1.