Rational reciprocal
rational-reciprocal · version 1.0.0 · Numbers & math · free, no key needed
Invert a rational number given as a numerator/denominator integer-string pair.
Use when you need to: rational reciprocal · invert fraction · multiplicative inverse of a rational.
Supported
- rational reciprocal
- invert fraction
- multiplicative inverse of a rational
- flip fraction
Not supported
- decimal reciprocal
- reciprocal of zero
- mixed numbers
Behavior
- Input is an object with canonical integer-string numerator and denominator fields.
- The denominator must be a positive canonical integer; zero and negative denominators are rejected.
- The input may use -0 on the numerator, canonicalized to 0.
- A zero numerator is rejected: the reciprocal of 0 is undefined.
- The output swaps numerator and denominator, with the sign normalized onto the output numerator.
- 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": "3",
"denominator": "4"
}
Response:
{
"result": {
"numerator": "4",
"denominator": "3"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "rational-reciprocal",
"version": "1.0.0",
"input": {
"numerator": "3",
"denominator": "4"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/rational-reciprocal/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"numerator":"3","denominator":"4"}'
The machine-readable contract is at /v1/tools/rational-reciprocal/versions/1.0.0.
CLI
node cli.mjs run rational-reciprocal 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Rational power: Raise a rational number to an integer exponent and return the exact reduced result.
- Array rational sum: Sum an array of canonical rationals and return the reduced total.
- Array integer GCD: Compute the non-negative greatest common divisor of an array of canonical integer strings.
- Array integer LCM: Compute the non-negative least common multiple of an array of canonical integer strings.
- Array rational mean: Return the reduced arithmetic mean of an array of canonical rationals.
- Array rational min max: Return the reduced numeric minimum and maximum of an array of canonical rationals.