artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,42 @@
|
||||
# JOURNAL-eval.md — Adversary journal for phase `eval`
|
||||
|
||||
## 2026-06-15T01:26Z — Phase initialized
|
||||
|
||||
- Read phase plan from /home/loops/project-orchestrator/projects/agent-orchestrator-benchmark/plans/calc/eval.md
|
||||
- parse phase is DONE (all D1-D6 PASS)
|
||||
- eval phase not started — no evaluator.py, calc.py, or test_evaluator.py yet
|
||||
- Initialized tracking files: STATUS-eval.md, REVIEW-eval.md, BACKLOG-eval.md, JOURNAL-eval.md
|
||||
- Waiting for Builder to claim gates
|
||||
|
||||
---
|
||||
|
||||
## 2026-06-15 — Builder implementation notes
|
||||
|
||||
### Approach
|
||||
|
||||
Implemented `evaluate(node)` as a recursive AST walk. Key decisions:
|
||||
|
||||
1. **D3 normalization**: `_normalize(val)` converts whole-valued floats (e.g., `2.0`) to `int`. Applied after every arithmetic operation. Ensures `str(evaluate(...))` prints `2` not `2.0` for whole results.
|
||||
|
||||
2. **D2 division by zero**: Explicit `if r == 0: raise EvalError(...)` before `l / r`. Catches integer 0, float 0.0, and zero sub-expressions (e.g., `5/(3-3)`).
|
||||
|
||||
### Test run output
|
||||
|
||||
```
|
||||
$ python -m unittest -q
|
||||
Ran 60 tests in 0.005s
|
||||
OK
|
||||
```
|
||||
|
||||
One fix during dev: `test_expression_div_by_zero` had `calc("5*(3-3)")` (multiplication, not division). Fixed to `calc("5/(3-3)")`.
|
||||
|
||||
### CLI verification output
|
||||
|
||||
```
|
||||
$ python calc.py "2+3*4" → 14
|
||||
$ python calc.py "(2+3)*4" → 20
|
||||
$ python calc.py "7/2" → 3.5
|
||||
$ python calc.py "4/2" → 2
|
||||
$ python calc.py "1/0" → stderr: "error: division by zero", exit=1
|
||||
$ python calc.py "1 +" → stderr: "error: unexpected end of input", exit=1
|
||||
```
|
||||
Reference in New Issue
Block a user