Description
Compare left=a*d and right=c*b using exact integer arithmetic, then reverse the comparison if the denominator signs differ; return order=-1,0,1 for first fraction versus second.
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.
Compare left=a*d and right=c*b using exact integer arithmetic, then reverse the comparison if the denominator signs differ; return order=-1,0,1 for first fraction versus second.
When to use this tool
Use Rational Signed Denominator Crossproduct Order when you need this particular exact fraction comparison, reduction, sign, denominator, or rounding component.
How to use the tool and how it works
- Enter firstNumerator, firstDenominator, secondNumerator, secondDenominator. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read order. Use the output convention below.
Parse four decimal integers and require nonzero denominators. Compare left=a*d and right=c*b using exact integer arithmetic, then reverse the comparison if the denominator signs differ; return order=-1,0,1 for first fraction versus second.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| firstNumerator | First 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. |
| firstDenominator | First 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. |
| secondNumerator | Second 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. |
| secondDenominator | Second 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. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| order | −1, 0, or 1 for the first value relative to the second. | Required. Safe integer. |
{
"input": {
"firstNumerator": "1",
"firstDenominator": "-2",
"secondNumerator": "1",
"secondDenominator": "3"
},
"output": {
"order": -1
}
} Limitations and assumptions
- Fractions need not be reduced and signed denominators are accepted. This compares exact rationals without converting to floating point, ordering uncertain values, or selecting a rounded display.
- 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.
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 Addition Denominator Lcm Factor
For positive integer first and second compute their gcd by Euclidean remainder, lcm=(first/gcd)*second, and require that lcm remain a positive safe integer.
- Rational Dyadic Denominator Flag
Reduce a supplied exact rational before testing whether its denominator is a power of two.