Page 1 of 1

[BUG][SOLVED] EnergyUsage should be double, not float

Posted: Wednesday 31 August 2022 18:24
by Francis91
Hi again !

I suspected a problem with lower values in power usage, but I've also seen a bug during the process.

In SQLHelper.cpp, line 5073 to 5076, all the values are in float, but energyUpToInterval and energyAfterInterval can become big (these are Wh).
I guess I'm not the only one with a value > 10000.000 kWh for a house.

float -> 4 bytes, precision is 7 digits
double -> 8 bytes, precision is 15 digits

For my case, with an Energy counter at 18228934.000 kWh, adding less than 2 Wh in float in 5 seconds means 1400 W ! (2 * 3600/5).

I was questionning why my results from my clamps are more and more different than my "real" bill from my provider, I have found why :-)

Re: [BUG][SOLVED] EnergyUsage should be double, not float

Posted: Thursday 01 September 2022 15:34
by Francis91