Page 1 of 1
[Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic
Posted: Sun Jul 17, 2016 4:50 am
by Madman
Pretty minor but confusing bug, which I assume is a floating point rounding issue, see below screenshot. This is the last in a chain of chemical plants making plastic, where only the first plant is actually producing anything. The one I've selected is the one at the very end, which says there is 3 petroleum, but is saying that is insufficient. I assume it's just the GUI rounding up and there's actually 2.9999 petroleum in the machine or something like that, but I've not seen it before in the 0.12.x line.
Sorry, no save as I took the screenshot and then fixed the problem before thinking about getting a save file
Re: [0.13.9] Rounding errors with GUI vs. game logic
Posted: Mon Jul 18, 2016 9:28 am
by Klonan
Thanks for the report
Even though its a minor issue,
I do think fluid input for recipes should round down, instead of to the nearest significant figure
Re: [0.13.9] Rounding errors with GUI vs. game logic
Posted: Mon Jul 18, 2016 2:49 pm
by Rseding91
Fixed for 0.13.10.
Re: [0.13.9] Rounding errors with GUI vs. game logic
Posted: Sun Jul 24, 2016 1:26 pm
by steinio
Probably fixed NOT.
You made it worse then before.
Now the tank is full, but the number is rounded down.
We had this similiar discussion before in combination with logic network, where the tank was full but the signal was not transmitted due rounding down.
viewtopic.php?f=11&t=24558&hilit=+tank+full
I beg you don't play with th numbers in this glumpsy way or you will have alot of new bug reports like the curved rail collision boxes,
All cause have an effect.
Greetings steinio
Re: [0.13.9] Rounding errors with GUI vs. game logic
Posted: Sun Jul 24, 2016 2:00 pm
by Rseding91
steinio wrote:Probably fixed NOT.
You made it worse then before.
Now the tank is full, but the number is rounded down.
We had this similiar discussion before in combination with logic network, where the tank was full but the signal was not transmitted due rounding down.
viewtopic.php?f=11&t=24558&hilit=+tank+full
I beg you don't play with th numbers in this glumpsy way or you will have alot of new bug reports like the curved rail collision boxes,
All cause have an effect.
Greetings steinio
It's a display only value. The tank doesn't have 2.5k fluid in it, it has something like 2499.9 fluid and so it rounds down to 2.4k since there isn't actually 2.5k fluid in the tank.
Re: [0.13.9] Rounding errors with GUI vs. game logic
Posted: Sun Jul 24, 2016 2:15 pm
by Klonan
Rseding91 wrote:steinio wrote:Probably fixed NOT.
You made it worse then before.
Now the tank is full, but the number is rounded down.
We had this similiar discussion before in combination with logic network, where the tank was full but the signal was not transmitted due rounding down.
viewtopic.php?f=11&t=24558&hilit=+tank+full
I beg you don't play with th numbers in this glumpsy way or you will have alot of new bug reports like the curved rail collision boxes,
All cause have an effect.
Greetings steinio
It's a display only value. The tank doesn't have 2.5k fluid in it, it has something like 2499.9 fluid and so it rounds down to 2.4k since there isn't actually 2.5k fluid in the tank.
The storage tanks gui should use natural rounding:
viewtopic.php?f=11&t=24558&p=154947&hilit=fluid#p154947
As it was in 0.12
Re: [0.13.9] Rounding errors with GUI vs. game logic
Posted: Sun Jul 24, 2016 3:24 pm
by steinio
Rseding91 wrote:
It's a display only value. The tank doesn't have 2.5k fluid in it, it has something like 2499.9 fluid and so it rounds down to 2.4k since there isn't actually 2.5k fluid in the tank.
- The circuit says 2500.
- The refinery stops, because tbere is no space for heavy oil.
- Only the tooltip says 2400.
So pleace bring them all to one base of using the numbers.
In my linked thread, we come to the agreement to round up, no it's changed back to round down.
Greetings steinio
Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic
Posted: Mon Jul 25, 2016 9:20 am
by Rseding91
I changed it so item counts will round down and fluid counts will round as rounding does.
There's no perfect fix for this, if fluid counts round up then the original issue is still present but that's just how it is.
Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic
Posted: Fri Oct 28, 2016 5:47 pm
by Smoovious
Perhaps the best idea for this would be for a config option to enable/disable 5/4 rounding?
Personally, I would prefer using 5/4 rounding.
-- Smoov
Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic
Posted: Sun Oct 30, 2016 1:16 am
by GlassDeviant
Dunno 'bout others, but I program combinators with near-enough values. For example, my chem plants crack heavy oil when there is 2400 or more lubricant and 500 or more heavy oil stored, because when it comes right down to the wire that last 100 lubricant is not going to mean the difference between life and death.
As long as the games internal representation of the fluids isn't "losing" something (more than five nines accuracy at any rate) along the way somewhere it really doesn't matter if the display values or the values in the circuit network are not a perfect match. You can work around the fact that mathematics does not always reflect reality, rocket scientists do it every day in the real world.
Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic
Posted: Sun Oct 30, 2016 9:16 pm
by Smoovious
my point is simply that the tank has a 2500 capacity, and with the 5/4 rounding from floating point to integer values on the circuit network, I only had to put 2500 to be 'full'... multiplied by the amount of tanks when monitoring others...
setting up displays also, would round properly.
didn't matter that it might have had 2499.5 in the tank, close enuf, call it full... but now we can't do that
if I'm monitoring 4 tanks, instead of 10,000, I have to use 9996, which just looks bad, and ends up rounding to 9.9k instead of 10k in the circuit network... so, did I set that up to 9900, or 9996?
It would be one thing if the circuit network used floating point numbers as well... I'd personally like that... but since we have to convert to integer, it is proper to 5/4 round rather than truncate to nearest integer.
anyways... just irritating to not have the 5/4 rounding... just feels wrong.
-- Smoov
Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic
Posted: Sun Oct 30, 2016 9:28 pm
by steinio
Smoovious wrote:my point is simply that the tank has a 2500 capacity, and with the 5/4 rounding from floating point to integer values on the circuit network, I only had to put 2500 to be 'full'... multiplied by the amount of tanks when monitoring others...
setting up displays also, would round properly.
didn't matter that it might have had 2499.5 in the tank, close enuf, call it full... but now we can't do that
if I'm monitoring 4 tanks, instead of 10,000, I have to use 9996, which just looks bad, and ends up rounding to 9.9k instead of 10k in the circuit network... so, did I set that up to 9900, or 9996?
It would be one thing if the circuit network used floating point numbers as well... I'd personally like that... but since we have to convert to integer, it is proper to 5/4 round rather than truncate to nearest integer.
anyways... just irritating to not have the 5/4 rounding... just feels wrong.
-- Smoov
The developers have something planned for 0.15 with the fluid handling and this is a tiny step in this direction.
So let us be patient and decide after the release of 0.15 about what we then complain
Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic
Posted: Thu Nov 03, 2016 1:24 am
by roaringdragon2
I do what GlassDeviant does, and there is a reason for it. Fluid has to flow, it doesn't just balance perfectly, This means that if your heavy oil tanks are far enough away from your refineries, your refineries might be full because the pipe in front of them is full, because the next pipe is, because the next five pipes are 0.1 away from being full, and it continues like this until the tank, where it is 5 away from being full. This means that the heavy oil is stopping the refineries, but if you only crack it if your heavy oil is = to 2500 in the tank, it is not being cracked.
Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic
Posted: Thu Nov 03, 2016 7:49 am
by Smoovious
This issue isn't about fluid dynamics at work, but about floating point values being truncated to integer instead of rounded to integer.
How the fluid gets into the tank isn't really relevant here.
-- Smoov