Description
Compare two exact rational numbers supplied as signed integer strings.
Number representation separates exact integer text, finite floating-point values and display spelling. Rational comparison can use exact cross products without decimal conversion, while floor/ceiling outputs still have a finite safe-integer range. Leading zeros and negative zero carry representational information that a numeric conversion or serializer can discard.
Compare two exact rational numbers supplied as signed integer strings.
When to use this tool
Use Rational Cross Product Comparison Sign when you already have firstNumeratorDecimal, firstDenominatorDecimal, secondNumeratorDecimal, secondDenominatorDecimal and need to compare two exact rational numbers supplied as signed integer strings.
How to use the tool and how it works
- Enter firstNumeratorDecimal, firstDenominatorDecimal, secondNumeratorDecimal, secondDenominatorDecimal. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read comparison. Use the output convention below.
Accept optional + or - followed by 1..128 decimal digits, including leading zeros. Require both denominators nonzero; form numerator cross difference with BigInt and reverse its sign for opposite-sign denominators. Return -1, 0 or 1.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| firstNumeratorDecimal | First Numerator Decimal | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| firstDenominatorDecimal | First Denominator Decimal | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| secondNumeratorDecimal | Second Numerator Decimal | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| secondDenominatorDecimal | Second Denominator Decimal | 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 |
|---|---|---|
| comparison | Exactly -1, 0 or 1 for the rational values; denominator signs are accounted for using exact integer cross-products. | Required. Safe integer. |
{
"input": {
"firstNumeratorDecimal": "1",
"firstDenominatorDecimal": "2",
"secondNumeratorDecimal": "2",
"secondDenominatorDecimal": "3"
},
"output": {
"comparison": -1
}
} Limitations and assumptions
- Inputs are integer strings, not decimal fractions or exponent notation; no reduction is required and numeric floating-point coercion is not used.
- 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
Use exact integer or rational arithmetic when exact large-number comparison is needed. Keep original token spelling for formatting questions, and verify that any transport or serialization step preserves distinctions such as leading zeros and negative zero.
References
Similar or alternative tools
- Integer Floor Ceiling Bracket Pair
Calculate floor and ceiling integers for a supplied finite number.
- Positional Digit Leading Zero Count
Count leading zeros in a positional decimal-digit transcription.