[2.1.11] Multiplying by large negative makes result positive

Bugs that are actually features.
Roaders
Inserter
Inserter
Posts: 37
Joined: Mon Jan 15, 2024 1:33 pm
Contact:

[2.1.11] Multiplying by large negative makes result positive

Post by Roaders »

Obviously I assume that this is my fault for doing something stupid and not the game's but I really can't think of any explanation other than this is a bug...
07-16-2026, 09-15-55.png
07-16-2026, 09-15-55.png (654.96 KiB) Viewed 195 times
multiplying each by -1,000,000 makes most things negative but large numbers turn positive - yellow Ammo is 1.9G

This is on 2.1 experimental.
Attachments
factorio-current.log
(11.77 KiB) Downloaded 16 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4694
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.1.11] Multiplying by large negative makes result positive

Post by boskid »

Unfortunately i have to classify this as Not a bug. Values on a circuit network are limited to a range [-2 147 483 648, 2 147 483 647] (also known as int32) and i am not seeing it ever changing at this point of game development since there are players that expect it to be behave this way or it would be a breaking change. What you are experiencing is an integer overflow because the result of multiplication is outside of allowed values range. This is covered by current design decisions and as such it wont be subject of a bug fix.
Roaders
Inserter
Inserter
Posts: 37
Joined: Mon Jan 15, 2024 1:33 pm
Contact:

Re: [2.1.11] Multiplying by large negative makes result positive

Post by Roaders »

I suspected it was probably an integer overflow. I'm surpised I've not seen this before.
Is there a better way of creating an negative number that is as large as possible?
robot256
Smart Inserter
Smart Inserter
Posts: 1422
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: [2.1.11] Multiplying by large negative makes result positive

Post by robot256 »

Roaders wrote: Thu Jul 16, 2026 1:51 pm I suspected it was probably an integer overflow. I'm surpised I've not seen this before.
Is there a better way of creating an negative number that is as large as possible?
If you have formulas enabled, type -2^31, or -0x80000000, or -0xffffffff. Hex numbers are converted and then capped to the largest magnitude of the given sign (which makes them less useful as a bit field, but it's helpful in this case).
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Post Reply

Return to “Not a bug”