Array rational min max
array-rational-min-max · version 1.0.0 · Numbers & math · free, no key needed
Return the reduced numeric minimum and maximum of an array of canonical rationals.
Use when you need to: array rational min max · minimum and maximum of rationals · min and max of an array of fractions.
Supported
- array rational min max
- minimum and maximum of rationals
- min and max of an array of fractions
Not supported
- index of min or max
- floating-point comparison
- sort rationals
- mean of rationals
- decimal string min max
- IEEE-754 arithmetic
Behavior
- Input values is a non-empty array of rational objects with canonical integer-string numerator and denominator.
- Each denominator must be a positive canonical integer; zero and negative denominators are rejected.
- Comparison uses BigInt cross-multiplication: a.numerator * b.denominator versus b.numerator * a.denominator.
- Each of min and max is the first-seen value among numeric equals, independently.
- Outputs are reduced, with the sign only on the numerator; zero is numerator 0 over denominator 1.
- At most 10000 values. Numerator and denominator of each output may have at most 1000 digits excluding sign.
Input
values(array of object, required): min items 1; max items 10000
Output
min(object, required)max(object, required)
Limits
- max values: 10000
- max digits: 1000
- min values: 1
Example
Request input:
{
"values": [
{
"numerator": "1",
"denominator": "2"
},
{
"numerator": "2",
"denominator": "3"
},
{
"numerator": "1",
"denominator": "4"
}
]
}
Response:
{
"result": {
"min": {
"numerator": "1",
"denominator": "4"
},
"max": {
"numerator": "2",
"denominator": "3"
}
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "array-rational-min-max",
"version": "1.0.0",
"input": {
"values": [
{
"numerator": "1",
"denominator": "2"
},
{
"numerator": "2",
"denominator": "3"
},
{
"numerator": "1",
"denominator": "4"
}
]
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/array-rational-min-max/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"values":[{"numerator":"1","denominator":"2"},{"numerator":"2","denominator":"3"},{"numerator":"1","denominator":"4"}]}'
The machine-readable contract is at /v1/tools/array-rational-min-max/versions/1.0.0.
CLI
node cli.mjs run array-rational-min-max 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Array integer min max: Return the numeric minimum and maximum of canonical integer strings.
- Array rational mean: Return the reduced arithmetic mean of an array of canonical rationals.
- Array rational sum: Sum an array of canonical rationals and return the reduced total.
- Array integer clamp: Clamp an array of canonical integer strings to optional inclusive min and max bounds.
- Rational multiply: Multiply two rational numbers given as numerator/denominator integer strings and return the reduced product.
- Rational subtract: Subtract one rational number from another, given as numerator/denominator integer strings, and return the reduced difference.