Surfaced by CodeRabbit's review of the #421 decomposition (#789). Pre-existing — the wrapper moved verbatim from codegen/api.py.
vera/runtime/math.py's _math_unary_host converts every ValueError from Python's math module into NaN, to mirror IEEE 754 / JS for genuine domain errors (e.g. log(-1) → NaN). But Python's math.log(0.0) raises ValueError (math domain error) at the pole, where IEEE 754 and JS Math.log(0) both give −∞. So Vera's Math.log(0) / log2(0) / log10(0) return NaN under the Python/wasmtime runtime while the browser/JS runtime returns −∞ — a parity violation.
Fix: special-case x == 0 → -inf in _math_unary_host for log/log2/log10, keeping the ValueError → NaN path for true domain errors. Add a tests/test_browser.py parity case for log(0).
Surfaced by CodeRabbit's review of the #421 decomposition (#789). Pre-existing — the wrapper moved verbatim from
codegen/api.py.vera/runtime/math.py's_math_unary_hostconverts everyValueErrorfrom Python'smathmodule intoNaN, to mirror IEEE 754 / JS for genuine domain errors (e.g.log(-1)→ NaN). But Python'smath.log(0.0)raisesValueError(math domain error) at the pole, where IEEE 754 and JSMath.log(0)both give −∞. So Vera'sMath.log(0)/log2(0)/log10(0)return NaN under the Python/wasmtime runtime while the browser/JS runtime returns −∞ — a parity violation.Fix: special-case
x == 0→-infin_math_unary_hostforlog/log2/log10, keeping theValueError → NaNpath for true domain errors. Add atests/test_browser.pyparity case forlog(0).