Page 1 of 1

[0.15.29] personal solar panel value wrong

Posted: Fri Jul 14, 2017 5:46 pm
by rorror
When you have 16 Personal solars, x 10kw = 160kw, this is ok.
total_kw_is_good.PNG
total_kw_is_good.PNG (167.17 KiB) Viewed 2351 times
When you have 17 Personal solars, x 10kw = 159kw, this is wrong. 1kw is missing?
this happens for, 17 to 28, (1kw missing) and at 29solar panels or higher, the amount is shown right again. (Did not test any higher.
total kw not good.PNG
total kw not good.PNG (207.23 KiB) Viewed 2351 times
Also tested this with mods disabled.

Re: [0.15.29] personal solar panel value wrong

Posted: Fri Jul 14, 2017 6:43 pm
by kovarex
This almost looks like floating point precision bug.

Re: [0.15.29] personal solar panel value wrong

Posted: Fri Jul 14, 2017 9:20 pm
by Rseding91
kovarex wrote:This almost looks like floating point precision bug.
It is, the value is not an exact integer and the display converts it to an integer value to be shown.

Re: [0.15.29] personal solar panel value wrong

Posted: Mon Jul 17, 2017 2:39 pm
by Engimage
So using round() instead of trunc() might fix the issue?