[0.16.51] Bonus of modules calculated with error
Posted: Fri Aug 03, 2018 6:02 am
AshenSwift freported on the mod forum of alien-module the following issue: https://mods.factorio.com/mod/alien-mod ... 000a5b9e22
After investigation i have the following problem with this code:
on level 29 the bonus is 28% and on level 58 the bonus is 57% for all other levels the bonus is correct. When i change levelbonus to:
everything works correctly. If this is not a bug then ignore the issue, this is most likely some floating point rounding issue IMHO.
I can even reproduce it in an online LUA console: https://repl.it/repls/ScornfulBeneficialChapter
After investigation i have the following problem with this code:
Code: Select all
for i = 1, 100, 1 do
local levelbonus = i * 0.01
data:extend({
{
[...]
effect =
{
consumption = { bonus = levelbonus },
speed = { bonus = levelbonus },
productivity = { bonus = levelbonus }
},
},
})
end
Code: Select all
local levelbonus = i * 0.01001
I can even reproduce it in an online LUA console: https://repl.it/repls/ScornfulBeneficialChapter