64-bit integer limit

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
Epb7304
Inserter
Inserter
Posts: 34
Joined: Thu Feb 28, 2019 8:02 pm
Contact:

64-bit integer limit

Post by Epb7304 »

TL;DR
expand integer limit to 64-bit

What ?
Currently signals work on a 32-bit system, which means that each signal can have 2^32 possible values (-2.1G < x < 2.1G)

I propose this be expanded to a 64-bit number, which would mean that each signal would have a possible 2^64 value or (-9.2E < x < 9.2E)
Why?
I know I am not alone when I say that I constantly will hit the 32-bit limit when designing circuits, this is typically when I want to compress a few smaller signals into 1 larger one, or when I want to track a large number of items. Expanding the integer limit to 64-bit would allow values in the Quintillions and I for one would believe the Can to be sufficiently kicked.

This also would not require the game to be run in 64-bit (if its not already) since you should just be able to assign 2 number slots per signal

Illiander42
Filter Inserter
Filter Inserter
Posts: 412
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: 64-bit integer limit

Post by Illiander42 »

Epb7304 wrote: ↑
Sat Mar 23, 2024 4:00 am
This also would not require the game to be run in 64-bit (if its not already) since you should just be able to assign 2 number slots per signal
As someone who's had to do that, it's a mess.

Anything you're doing in particular that needs more than 32 bits?

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2551
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: 64-bit integer limit

Post by FuryoftheStars »

Epb7304 wrote: ↑
Sat Mar 23, 2024 4:00 am
This also would not require the game to be run in 64-bit (if its not already)
https://factorio.com/blog/post/fff-158
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Epb7304
Inserter
Inserter
Posts: 34
Joined: Thu Feb 28, 2019 8:02 pm
Contact:

Re: 64-bit integer limit

Post by Epb7304 »

FuryoftheStars wrote: ↑
Sat Mar 23, 2024 11:33 pm
Epb7304 wrote: ↑
Sat Mar 23, 2024 4:00 am
This also would not require the game to be run in 64-bit (if its not already)
https://factorio.com/blog/post/fff-158
Even better, that would make this change nearly seamless and not overly complicated either

Epb7304
Inserter
Inserter
Posts: 34
Joined: Thu Feb 28, 2019 8:02 pm
Contact:

Re: 64-bit integer limit

Post by Epb7304 »

Illiander42 wrote: ↑
Sat Mar 23, 2024 11:03 pm
Epb7304 wrote: ↑
Sat Mar 23, 2024 4:00 am
This also would not require the game to be run in 64-bit (if its not already) since you should just be able to assign 2 number slots per signal
As someone who's had to do that, it's a mess.

Anything you're doing in particular that needs more than 32 bits?
The biggest thing is actually to do with FFF 402 and compressing my data streams to only 1 signal so it will not interfere with other information in the data stream, this issue also arises however when wanting to store a particularly large value. Say, the amount of power your base is producing/consuming, or how many seconds your base has been working for, or how many iron plates you have made (yes those are in statistics, but this would be for a display board or a smart base system).

mmmPI
Smart Inserter
Smart Inserter
Posts: 2749
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: 64-bit integer limit

Post by mmmPI »

Epb7304 wrote: ↑
Sun Mar 24, 2024 3:24 am
this issue also arises however when wanting to store a particularly large value. Say, the amount of power your base is producing/consuming,
One can't read that on circuit though, it's only the accumulator charge.
Epb7304 wrote: ↑
Sun Mar 24, 2024 3:24 am
or how many seconds your base has been working for, or how many iron plates you have made (yes those are in statistics, but this would be for a display board or a smart base system).
2 billion second is 60 years or so which makes it unlikely to me that it would be achieved in a game of factorio , but even if going x64 speed during a full year, it would be possible to store the number of hour, or days, similar to storing the number of MW and not Watt to reduce by a factor 1 000 000.

Epb7304 wrote: ↑
Sat Mar 23, 2024 4:00 am
This also would not require the game to be run in 64-bit (if its not already) since you should just be able to assign 2 number slots per signal
The same apply in the game, it's possible if you want to store 3 billions second worth of time to use the channel "C" and "D" instead of just 1 that would see an overflow.

I'm not against the suggestion but there are other topics with better arguments :(

Illiander42
Filter Inserter
Filter Inserter
Posts: 412
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: 64-bit integer limit

Post by Illiander42 »

Epb7304 wrote: ↑
Sun Mar 24, 2024 3:24 am
Illiander42 wrote: ↑
Sat Mar 23, 2024 11:03 pm
Epb7304 wrote: ↑
Sat Mar 23, 2024 4:00 am
This also would not require the game to be run in 64-bit (if its not already) since you should just be able to assign 2 number slots per signal
As someone who's had to do that, it's a mess.

Anything you're doing in particular that needs more than 32 bits?
The biggest thing is actually to do with FFF 402 and compressing my data streams to only 1 signal so it will not interfere with other information in the data stream, this issue also arises however when wanting to store a particularly large value. Say, the amount of power your base is producing/consuming, or how many seconds your base has been working for, or how many iron plates you have made (yes those are in statistics, but this would be for a display board or a smart base system).
Timeslotting and negotiating for channel ownership works fine for putting mutiple data streams over radar connections. As soon as we get access to new combinators there'll probably be a few people putting out blueprint books for that. Happy to run you through the broad strokes of how to do those if you want (I'm waiting for new combinators to do my blueprints).

And as the other poster said, you can do large value counting yourself if you really need it.

The only reason I can think of for this would be if we run out of bitflag space in the non-item signals, and that can be solved by adding more virtual signals to the pile instead of making the numbers bigger.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: 64-bit integer limit

Post by boskid »

This is unlikely to happen unless we would update Lua to something newer than 5.2. If circuit network signals would have values based on 64 bit integers then scripts would have a hard time setting some values since all values in lua 5.2 are based on a `double` which cannot represent all 64 bit integers precisely.

Qon
Smart Inserter
Smart Inserter
Posts: 2118
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: 64-bit integer limit

Post by Qon »

boskid wrote: ↑
Sun Mar 24, 2024 10:41 am
This is unlikely to happen unless we would update Lua to something newer than 5.2. If circuit network signals would have values based on 64 bit integers then scripts would have a hard time setting some values since all values in lua 5.2 are based on a `double` which cannot represent all 64 bit integers precisely.
How about 53-bit integers then? It's more than 32 so we get some benefit. We can't store 2 32-bit signals in one, but we can store 2 26-bit signals or 3 17-bit signals, which is both a benefit over being limited to e.g. 2 16-bit numbers when packing multiple values into a single signal type.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2250
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: 64-bit integer limit

Post by boskid »

Qon wrote: ↑
Sun Mar 24, 2024 11:06 am
How about 53-bit integers then? It's more than 32 so we get some benefit. We can't store 2 32-bit signals in one, but we can store 2 26-bit signals or 3 17-bit signals, which is both a benefit over being limited to e.g. 2 16-bit numbers when packing multiple values into a single signal type.
How about 32-bit integers? Its possible to store 3 10-bit signals or 2 16-bit signals.

Illiander42
Filter Inserter
Filter Inserter
Posts: 412
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: 64-bit integer limit

Post by Illiander42 »

boskid wrote: ↑
Sun Mar 24, 2024 10:41 am
This is unlikely to happen unless we would update Lua to something newer than 5.2. If circuit network signals would have values based on 64 bit integers then scripts would have a hard time setting some values since all values in lua 5.2 are based on a `double` which cannot represent all 64 bit integers precisely.
Would the UTF support (which is always good for localisation) be worth the upgrade pain?

pleegwat
Filter Inserter
Filter Inserter
Posts: 260
Joined: Fri May 19, 2017 7:31 pm
Contact:

Re: 64-bit integer limit

Post by pleegwat »

Epb7304 wrote: ↑
Sun Mar 24, 2024 3:24 am
for a display board
A limited bignum implementation in combinators should not be too difficult, especially since you're only adding in scalars. If the accumulator is larger than 1 billion decimal, subtract 1 billion from it and increment the next accumulator up. I guess that would be 3 or 4 combinators for every additional factor of a billion? And I'm sure it vectorizes.

Illiander42
Filter Inserter
Filter Inserter
Posts: 412
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: 64-bit integer limit

Post by Illiander42 »

pleegwat wrote: ↑
Sun Mar 24, 2024 2:13 pm
Epb7304 wrote: ↑
Sun Mar 24, 2024 3:24 am
for a display board
A limited bignum implementation in combinators should not be too difficult, especially since you're only adding in scalars. If the accumulator is larger than 1 billion decimal, subtract 1 billion from it and increment the next accumulator up. I guess that would be 3 or 4 combinators for every additional factor of a billion? And I'm sure it vectorizes.
2 combinators if deciders could output an arbitrary number, unless it needs a tick delay to not double-count? Possibly a single combinator in 2.0.

Post Reply

Return to β€œIdeas and Suggestions”