# 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.**

## 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 1001
- `denominator` (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:

```json
{
  "numerator": "-7",
  "denominator": "2"
}
```

Response:

```json
{
  "result": {
    "negative": true,
    "whole": "3",
    "numerator": "1",
    "denominator": "2"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "rational-to-mixed-number",
  "version": "1.0.0",
  "input": {
    "numerator": "-7",
    "denominator": "2"
  }
}
```

### HTTP (no key)

```sh
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](/v1/tools/rational-to-mixed-number/versions/1.0.0).

### CLI

```sh
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/](/clients/cli/).

## Related tools

- [Mixed number to rational](/tools/mixed-number-to-rational): Convert a mixed number (sign, whole part, proper-fraction numerator and denominator) into a single reduced rational.
- [Rational power](/tools/rational-power): Raise a rational number to an integer exponent and return the exact reduced result.
- [Rational simplify](/tools/rational-simplify): Reduce a numerator/denominator pair to lowest terms with the sign normalized onto the numerator.
- [Rational reciprocal](/tools/rational-reciprocal): Invert a rational number given as a numerator/denominator integer-string pair.
- [Angle DMS convert](/tools/angle-dms-convert): Convert a signed integer angle between degrees, arcminutes, and arcseconds as an exact rational.
- [Array integer clamp](/tools/array-integer-clamp): Clamp an array of canonical integer strings to optional inclusive min and max bounds.
