## Fractional/rounding glitches?

Place to post guides, observations, things related to modding that are not mods themselves.
dracosilv
Manual Inserter
Posts: 1
Joined: Wed Nov 08, 2017 10:45 am
Contact:

### Fractional/rounding glitches?

I don't know if this is a bug in factorio or not.. or if its in the mods I'm using or not.. but I've sometimes had it where pipes don't seem to fully empty.. (they register 0.0 fluid in them) and then tanks or other machines seem to have slightly less than round-numbers of materials in them..

Is this a glitch of the mods? (I'm playing seablock) or is it something inherent to the system? (I swear I've seen it happen in vanilla factorio with oil/oil-products as well)

Sorry if this is the wrong location for this thread, its my first post and I'm unsure exactly where to post it...
Seablock1.png (2.08 MiB) Viewed 679 times
Seablock2.png (1.94 MiB) Viewed 679 times

Rseding91
Factorio Staff
Posts: 11923
Joined: Wed Jun 11, 2014 5:23 am
Contact:

### Re: Fractional/rounding glitches?

It's simply how floating point numbers work in computers: it's not possible to represent every real number in binary format because it doesn't have infinite precision.

For example: 1/3rd can't be stored in a single value because it's technically infinite: 0.3333333333333~ forever.
If you want to get ahold of me I'm almost always on Discord.

sillyfly
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

### Re: Fractional/rounding glitches?

More precisely - if its binary representation isn't finite.
For example, 1/5 = 0.2, which has a finite representation in base 10. However, in base 2 it is 0.00110011..., so it can still not be represented accurately in a binary floating point number (=the sane way computers handle non-integers)