A language model doing arithmetic in its head is guessing; this makes the answer a computed one, and the batch call means a page of figures costs a single round trip. The author's own notes on parser bugs found during development — grammar ambiguity around `-5`, precision loss on expressions like `1e20 + 1 - 1e20` — say more about the care taken than a feature list would.
A small Rust server that parses and evaluates arithmetic expressions and hands the model a real result. It covers the four operators with correct precedence, parentheses, decimals, scientific notation and unary minus, and returns a typed error rather than a wrong number when the input is malformed.
- `evaluate_batch` takes a list of expressions and returns the results in one call
- Full precedence and grouping: `(2 + 3) * 4` evaluates the way it reads
- Scientific notation — `1e10`, `2.5e-3`, `1.23E+4` — and decimals such as `3.14159`
- Unary operators, including nested forms like `-(5 + 3)`
- Division by zero surfaces as a distinct error instead of a NaN drifting through the answer
- The same binary doubles as a CLI: `cargo run --bin stdio_direct -- eval "2 + 3 * 4"`
Nothing to sign up for. Build with `cargo build --release` and point your client at the `stdio_direct` binary in `target/release`. Communicates over stdio. MIT licensed.
