Rational to mixed number
rational-to-mixed-number · version 1.0.0 · Numbers & math · free, no key needed
Convert a rational number into a sign, whole part, and proper-fraction numerator/denominator.
Use when you need to: rational to mixed number · convert fraction to mixed number · improper fraction to mixed number.
Decide before calling
Read the versioned contract and the supported scope below. Reuse rational-to-mixed-number@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use rational-to-mixed-number@1.0.0 for rational to mixed number. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- rational to mixed number
- convert fraction to mixed number
- improper fraction to mixed number
Not supported
- mixed number to rational
- decimal conversion
Behavior
- Input is an object with canonical integer-string numerator and denominator fields; denominator must be a positive canonical integer.
- The input need not be in lowest terms; it is reduced first.
- whole is floor(|numerator| / denominator) and the output numerator is |numerator| mod denominator, so 0 <= numerator < denominator.
- negative is true only when the reduced value is strictly negative; zero is always negative:false, whole:"0", numerator:"0".
- The output denominator equals the reduced input denominator; the fractional part is already in lowest terms because the reduced whole rational was.
- Each field may have at most 1000 digits excluding sign.
Input
numerator(string, required): max length 1001denominator(string, required): max length 1001
Output
negative(boolean, required)whole(string, required)numerator(string, required)denominator(string, required)
Limits
- max digits: 1000
Example
Request input:
{
"numerator": "-7",
"denominator": "2"
}
Response:
{
"result": {
"negative": true,
"whole": "3",
"numerator": "1",
"denominator": "2"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "rational-to-mixed-number",
"version": "1.0.0",
"input": {
"numerator": "-7",
"denominator": "2"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/rational-to-mixed-number/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"numerator":"-7","denominator":"2"}'
The machine-readable contract is at /v1/tools/rational-to-mixed-number/versions/1.0.0.
CLI
node cli.mjs run rational-to-mixed-number 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.
- Number engineering format: Format an exact decimal in scientific or engineering notation with explicit precision and rounding.
- Number to words en: Spell an integer or exact decimal in English words and return the styled text.
- Ordinal to words en: Spell an integer ordinal in English words and return the styled ordinal text.
- Rational power: Raise a rational number to an integer exponent and return the exact reduced result.
- Rational simplify: Reduce a numerator/denominator pair to lowest terms with the sign normalized onto the numerator.