Floating-point stability of an expression over variable ranges
Evaluates a real-valued expression in binary64 (or binary32) on a deterministic grid over the caller's variable ranges and compares each point with a certified arbitrary-precision reference, reporting the decimal digits lost, the worst input, and overflow, underflow or NaN. Recognises and rewrites exp(x)-1, 1-cos(x), log(1+x), sqrt(a)-sqrt(b), a^2-b^2, the quadratic formula, sqrt(x^2+y^2) and log-sum-exp, measures the rewrite on the same grid, and can score a caller-supplied alternative. Samples a finite grid, so it can find instability but not prove its absence; the expression grammar has + - * / ^, the listed functions and no user code.
What you get
Catastrophic cancellation and spurious overflow pass every happy-path test and fail only on the inputs nobody sampled.
Call it
Send the JSON body below to https://agents.writerslogic.com/api/v1/float-stability. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.
curl -i -X POST https://agents.writerslogic.com/api/v1/float-stability \
-H 'content-type: application/json' \
-d '{"expression":"exp(x) - 1","variables":[{"name":"x","min":1e-12,"max":1}]}'
Input
| Field | Type | Required | Description |
|---|---|---|---|
expression | string; length 0..500 | yes | Expression in the declared variables, e.g. 'exp(x) - 1'. Operators + - * / ^ (or **); functions sqrt exp expm1 log log1p log2 log10 sin cos tan atan sinh cosh tanh abs pow hypot min max; constants pi, e. |
variables | array<object>; max 6 items | yes | Range of every free variable. |
precision | string; one of "binary64", "binary32" | no | Arithmetic of the code under test. Default binary64. |
alternative | string; length 0..500 | no | Optional algebraically equal expression to score on the same grid. |
maxDigitsLost | integer; 0..16 | no | Fail above this many lost digits. Default 4. |
Example request body
{
"expression": "exp(x) - 1",
"variables": [
{
"name": "x",
"min": 1e-12,
"max": 1
}
]
}
Result
The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.
| Field | Type | Required | Description |
|---|---|---|---|
status | string; one of "pass", "fail", "unknown", "unsupported" | no | pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass. |
precision | string | no | |
expression | string | no | Canonical form of the parsed expression. |
samples | object | no | total, certified and skipped counts (domain error, uncertified reference, out of binary range). |
worstDigitsLost | number | no | |
worst | array<object> | no | |
patterns | array<object> | no | |
suggestedExpression | string | no | |
suggestedWorstDigitsLost | number | no | |
alternativeWorstDigitsLost | number | no | |
witnesses | array<object> | no | |
versions | object | no | Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile). |
limits | array<string> | no | |
deterministic | boolean | no | Always true: pure code, no model. |
Pay and connect
Available through: x402 (USDC on Base), MCP. MCP clients reach it through the code-preflight-kit package.
Machine-readable
- This agent as JSON (schemas, example, OpenAPI operation)
- Free signed sample response
- OpenAPI 3.1 · Catalog · Index of every agent