[Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic

This subforum contains all the issues which we already resolved.
Madman
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sun Jul 17, 2016 4:42 am
Contact:

[Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic

Post 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 :)
Attachments
factorio-rounding-error.png
factorio-rounding-error.png (489.55 KiB) Viewed 11829 times
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5304
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.13.9] Rounding errors with GUI vs. game logic

Post 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
Rseding91
Factorio Staff
Factorio Staff
Posts: 14646
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.9] Rounding errors with GUI vs. game logic

Post by Rseding91 »

Fixed for 0.13.10.
If you want to get ahold of me I'm almost always on Discord.
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [0.13.9] Rounding errors with GUI vs. game logic

Post 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
Attachments
Oil tank.png
Oil tank.png (829.32 KiB) Viewed 11615 times
Image

Transport Belt Repair Man

View unread Posts
Rseding91
Factorio Staff
Factorio Staff
Posts: 14646
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.13.9] Rounding errors with GUI vs. game logic

Post 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.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5304
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.13.9] Rounding errors with GUI vs. game logic

Post 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
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [0.13.9] Rounding errors with GUI vs. game logic

Post 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
Image

Transport Belt Repair Man

View unread Posts
Rseding91
Factorio Staff
Factorio Staff
Posts: 14646
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic

Post 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.
If you want to get ahold of me I'm almost always on Discord.
Smoovious
Long Handed Inserter
Long Handed Inserter
Posts: 99
Joined: Sun Jan 31, 2016 12:14 am
Contact:

Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic

Post 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
User avatar
GlassDeviant
Fast Inserter
Fast Inserter
Posts: 170
Joined: Wed Feb 11, 2015 1:51 am
Contact:

Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic

Post 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.
- GD

Sorry if my posts are becoming difficult to read, my typing ability is rapidly deteriorating due to a nerve disorder. I try to clean them up before posting but don't always get every last typo.
Smoovious
Long Handed Inserter
Long Handed Inserter
Posts: 99
Joined: Sun Jan 31, 2016 12:14 am
Contact:

Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic

Post 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
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic

Post 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 ;)
Image

Transport Belt Repair Man

View unread Posts
roaringdragon2
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Apr 22, 2016 10:01 pm
Contact:

Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic

Post 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.
Smoovious
Long Handed Inserter
Long Handed Inserter
Posts: 99
Joined: Sun Jan 31, 2016 12:14 am
Contact:

Re: [Rseding91] [0.13.9] [Reopened] Rounding errors with GUI vs. game logic

Post 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
Post Reply

Return to “Resolved Problems and Bugs”