[2.0.19] Inconsistent handling of overflows with numeric textboxes

Post your bugs and problems so we can fix them.
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 843
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

[2.0.19] Inconsistent handling of overflows with numeric textboxes

Post by IsaacOscar »

edit: I have updated this bug report from 2.0.15 to 2.0.19, and deleted the part that was a duplicate of viewtopic.php?f=11&t=117887&p=634501&hi ... sh#p634501

Consider the 4 text boxes at the bottom of these dialogs:
11-18-2024, 15-31-39.png
11-18-2024, 15-31-39.png (2.69 MiB) Viewed 144 times
11-18-2024, 15-32-48.png
11-18-2024, 15-32-48.png (2.49 MiB) Viewed 144 times
11-18-2024, 15-24-37.png
11-18-2024, 15-24-37.png (1.59 MiB) Viewed 144 times
The first dialog is a circuit condition to enable an assembler, the second is for setting the output of a constant combinator, the second , and the third dialog is when configuring a personal logistic request.

After some experimentation, there seem to be three seperate ways of handling these number fields:
  1. the way done by the "Select a Signal" dialog box above
  2. the way done by the "Select the filter" dialog box (which behaves the the same as minimum of the "Set Request" dialog)
  3. the way done by the maximum of the "Set Request"
The way they handle numbers that are bigger than 2147483647 ( 2^31 − 1) or smaller than -2147483648 (-2^31) differs, for example:

if you enter "9999999999" into the boxes you get:
  1. ("Select a signal") clamps to 2147483647
  2. ("Select the filter" and the minimum of "Set Request) overflows to 1410065407 (which is 9999999999 - 4*2^31)
  3. (maximum of "Set Request") clamps to "inf"
If you try an even bigger number, e.g. "999999999999" (it has two more nines)
  1. clamps to 2147483647
  2. overflows to -727379969 (which is 999999999999 - 466*2^31)
  3. clamps again to "inf"
Now try -9999999999
  1. clamps to -2147483648
  2. overflows to -1410065407
  3. you get 2884901889, but it also sets the minimum amount to -1410065407
Finally, for -999999999999
  1. -2147483648
  2. -1410065407
  3. 727379969, and also sets the minimum to this number as well.
Personally, I prefer the behaviour of box #1, as I often put a lot of 9's because I want a number that roughly corresponds to infinite (whereas "inf' doesn't behave like a really large number, see viewtopic.php?f=23&t=117306).

However, I think the result should be clamped to 0 if it would be negative and it doesn't make sense in context (e.g. a negative logistic request).
Post Reply

Return to “Bug Reports”