Hacker News new | ask | show | jobs
by zgs 561 days ago
There is a second issue with the code. The calculation of the mean isn't numerically stable. Instead use:

mean_power = mean_power + (power - mean_power) / count