Productivity bonus applied slightly too late

Things that has been reported already before.
ndh
Inserter
Inserter
Posts: 36
Joined: Sat Apr 29, 2023 7:19 pm
Contact:

Productivity bonus applied slightly too late

Post by ndh »

I'm using an assembly machine 2 with two production modules 1. These two modules provide a bonus of 8 %, that's 108/100=27/25.

I've put in the required inputs for 25*27*2=1350 products, and I'm expecting 25*27*2 * (27/25) = 1458 outputs. But I'm only seeing 1457.

As soon as I put in another set of inputs, and let the am produce for two ticks, the set of bonus products is getting produced, and the "Products finished" counter jumps to 1458.

07-17-2025, 20-39-47.png
07-17-2025, 20-39-47.png (720.31 KiB) Viewed 155 times

There's a couple bug reports for this issue: 1 2 3 4

I'm probably in the vast minority, but like these other posters I enjoy designing factories that produce an exact amount of items. In 2.0 we can now set the recipe via circuit network, so I think this is more relevant than before. I mean. There are dozens of us! Probably.

I've asked on Discord about it. Rseding91 was so kind to explain that the game uses double precision to accumulate the bonus productivity.

I implemented some test code and was able to reproduce it. I would be happy to look at the actual code that is being used in the game.

I experimented a bit with a simple fix. Using v-1.0>=-eps instead of v>=1.0 and resetting the value to 0 if -eps<=value<=eps would fix it for eps=1e-11. It would reset both progress and the bonus accumulator to 0.0 every 81 cycles.

Rseding91 stated before that fixing this would not be worth spending time. I think a fix could be pretty easy. But I'm not sure how many cases there are, even when just considering vanilla without mods, and which value of eps fixes it for every case. E. g. 1e-11 would still fix it for my case, but 1e-12 wouldn't.

There's probably some way to determine this, though. What's the slowest recipe in vanilla? 60 seconds Kovarex?
Rseding91
Factorio Staff
Factorio Staff
Posts: 15875
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Productivity bonus applied slightly too late

Post by Rseding91 »

We used to have some form of that, and it generated other issues and was eventually removed. There is no system that will work except using a slower data type that can store repeating fractions in full precision. No binary type supports that and at some point fails to properly sore 1/3rd and you lose some tiny amount of value.

Considering the nature of Factorio: mass production at high speeds. Making the 99% case slower for the 1% case with an easy work around doesn’t make sense.
If you want to get ahold of me I'm almost always on Discord.
ndh
Inserter
Inserter
Posts: 36
Joined: Sat Apr 29, 2023 7:19 pm
Contact:

Re: Productivity bonus applied slightly too late

Post by ndh »

I see. And I agree, it's quite an edge case. Thank you for letting me know.
Post Reply

Return to “Duplicates”