Commit Graph

2 Commits

Author SHA1 Message Date
javis-bot
fc4b77f826 fix(tools): calculator keeps decimals exact as written
Numbers were binary floats, so ceil(1.1*100) gave 111 and
floor(0.3/0.1) gave 2. Literals are now exact fractions as written
(1.1 is 11/10): + - * / // % and whole-number powers have no rounding
error; only math functions and fractional powers use floats. The power
size guard covers exact fractions too (2^-100000 is refused, not 0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:45:54 +09:00
javis-bot
99b7234336 feat(tools): calculator tool for exact arithmetic
Models work numbers out in their heads and get multi-digit products and
powers wrong (qwen3:8b: 3847 x 2963 as 11,378,261; in the reply loop it
searched the web for it and gave no answer). The calculator evaluates a
whitelisted ast (numbers, operators, a few math functions, pi/e), never
code, with a 200 character cap and a power size limit so nothing hangs.
Idea from OpenJarvis's calculator tool (Apache 2.0).

Eval (qwen3:8b, v2 setup): 0/2 before, 12/12 over four runs after; the
unrelated question never calls it. Router evals unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:33:53 +09:00