Rational simplify
rational-simplify · version 1.0.0 · Numbers & math · free, no key needed
Reduce a numerator/denominator pair to lowest terms with the sign normalized onto the numerator.
Use when you need to: rational simplify · simplify fraction · reduce fraction to lowest terms.
Supported
- rational simplify
- simplify fraction
- reduce fraction to lowest terms
- normalize rational sign
Not supported
- decimal simplify
- continued fractions
- mixed numbers
Behavior
- Input is an object with canonical integer-string numerator and denominator fields.
- Unlike rational-add and rational-multiply, the denominator may be negative; only 0 is rejected.
- Inputs may use -0 on either field, which is canonicalized to 0 before evaluation.
- The output is numerator / gcd(|numerator|,|denominator|) over denominator / gcd(...), with the sign moved entirely onto the numerator.
- Zero is always returned as numerator 0 over denominator 1, regardless of the input denominator sign.
- Each input and output numerator and denominator may have at most 1000 digits excluding sign.
Input
numerator(string, required): max length 1001denominator(string, required): max length 1001
Output
numerator(string, required)denominator(string, required)
Limits
- max digits: 1000
Example
Request input:
{
"numerator": "-8",
"denominator": "-12"
}
Response:
{
"result": {
"numerator": "2",
"denominator": "3"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "rational-simplify",
"version": "1.0.0",
"input": {
"numerator": "-8",
"denominator": "-12"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/rational-simplify/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"numerator":"-8","denominator":"-12"}'
The machine-readable contract is at /v1/tools/rational-simplify/versions/1.0.0.
CLI
node cli.mjs run rational-simplify 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Mixed number to rational: Convert a mixed number (sign, whole part, proper-fraction numerator and denominator) into a single reduced rational.
- Rational power: Raise a rational number to an integer exponent and return the exact reduced result.
- Rational to mixed number: Convert a rational number into a sign, whole part, and proper-fraction numerator/denominator.
- Rational reciprocal: Invert a rational number given as a numerator/denominator integer-string pair.
- Array integer clamp: Clamp an array of canonical integer strings to optional inclusive min and max bounds.
- Array rational mean: Return the reduced arithmetic mean of an array of canonical rationals.