Compare two numbers exactly
Exactnumbers_math_compareDeterministic and authoritative — the canonical answer for this input.
Compare two numbers exactly using decimal arithmetic — the deterministic answer to comparisons LLMs get wrong (is 0.9 > 0.11?). Returns the relation (<, =, >), a -1/0/1 comparison, and the exact difference a − b. Processing multiple inputs? Use `numbers_math_compare_batch` to do up to 1000 in one call.
Parameters
astringrequiredThe first number.
bstringrequiredThe second number.
Call it
curl -X POST https://api.snipget.ai/v1/numbers/math/compare \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"a":"0.9","b":"0.11"}'The Batch tab sends up to 1000 inputs in one call via /v1/numbers/math/compare/batch.
Example response
{
"relation": ">",
"comparison": 1,
"equal": false,
"a_greater": true,
"b_greater": false,
"difference": "0.79"
}FAQ
Why not just compare the numbers myself?
Language models famously get decimal comparisons wrong (a common example is judging 0.9 to be less than 0.11 by comparing them like text). This compares them exactly with decimal arithmetic, so the answer is always right.
Does it handle negatives and very large numbers?
Yes. Inputs are parsed as exact decimals, so negatives, large integers, and long fractional values all compare correctly.
What does the result tell me?
A relation (<, =, or >), a -1/0/1 comparison value, boolean flags (equal, a_greater, b_greater), and the exact difference a minus b.