Skip to content
DevMeme
2859 of 7590
Bugs Post #3157 · source on Telegram

Safety board shows negative days after 32-bit signed integer rollover mishap

Description

A cartoon-style roadside safety sign sits on two wooden posts against a washed-out desert backdrop. The sign reads, in large red letters centered on the board, “DAYS SINCE LAST” on the first two lines and “INTEGER ROLLOVER” on the third line. In the upper left corner of the sign, a digital counter displays the turquoise number “-2,147,483,648”, the minimum value of a 32-bit signed integer, creating an absurd negative day count. The meme humorously highlights an integer overflow bug where a day counter wrapped around, turning positive time into a gigantic negative value - an inside joke for engineers familiar with two’s-complement limits and rollover incidents. Visually, the muted greens and browns of the background and the exaggerated red headline mimic a workplace “days without accident” board, giving technical context about counters, overflow errors, and the importance of boundary checks

Comments

29
Anonymous ★ Top Pick When the safety board flipped to - 2,147,483,648 days, leadership bragged about six million years of zero incidents - turns out unsigned optimism and signed integers don’t mix
  1. Anonymous ★ Top Pick

    When the safety board flipped to - 2,147,483,648 days, leadership bragged about six million years of zero incidents - turns out unsigned optimism and signed integers don’t mix

  2. Anonymous

    The irony is that if this sign's counter is using a 32-bit integer, it'll overflow in about 129 days, resetting to -2,147,483,648 and suddenly claiming we had an integer rollover 5.8 million years ago - which, coincidentally, is exactly how production incidents feel when you're the one who has to fix them at 3 AM

  3. Anonymous

    The real tragedy isn't the overflow itself - it's that someone chose a signed integer for a counter that should never be negative. This is what happens when your 'days since incident' tracker becomes the incident. At least they're consistent: if you're going to have an integer overflow, might as well have it on the sign tracking integer overflows. It's the software equivalent of a fire station burning down, except this one was entirely preventable with a uint32_t or, you know, a proper data type for counting days since the Unix epoch. But hey, at least we know exactly when this happened: sometime after 5.8 million years of incident-free operation

  4. Anonymous

    When your legacy counter wraps to INT_MIN, proving even time travel can't save 32-bit systems from themselves

  5. Anonymous

    Our safety KPI uses int32; after 2,147,483,647 days it wraps to −2,147,483,648, and suddenly we’ve been compliant since before the Unix epoch

  6. Anonymous

    We implemented the safety KPI with int32; one overflow later and compliance says we’re safe for the next −2,147,483,648 days - two’s‑complement optimism at enterprise scale

  7. @azizhakberdiev 5y

    JS joins chat

    1. Deleted Account 5y

      "-2,147,383,648"

      1. @pavloalpha 5y

        js: ""

      2. @azizhakberdiev 5y

        JS has no integers limit. Numbers can exceed max_safe_integer_value with loss of precision, soon after they turn into exponential number, and when engine considers that it cannot increase number anymore, the value turns into special Infinity value There is also BigInt type in js which allows to process VERY BIG numbers. It never becomes Infinity and never commits rollover (nor simple numbers do it) JS doesnt know what rollover is

        1. Deleted Account 5y

          so js has float-like semantics for ints

          1. @RiedleroD 5y

            afaik js only has floats

            1. Deleted Account 5y

              even lua now has ints

              1. @RiedleroD 5y

                now? You mean it didn't have them from the beginning?

                1. Deleted Account 5y

                  only in 5.4

                  1. @RiedleroD 5y

                    is that new, old, ancient…?

                    1. Deleted Account 5y

                      that's newest

                      1. @RiedleroD 5y

                        So they just now added ints

                        1. Deleted Account 5y

                          almost a year ago

                          1. @RiedleroD 5y

                            oh, so the newest release of lua is almost a year old, yes?

                            1. Deleted Account 5y

                              yes

            2. @azizhakberdiev 5y

              Yep, they are stored in IEEE-754 format, 52 bits for ints, 11 for floats and 1 for sign

              1. @azizhakberdiev 5y

                MAX_SAFE_INTGERER constant is 2^53 - 1

                1. @ZgGPuo8dZef58K6hxxGVj3Z2 5y

                  The fun part is you cannot store 2^53 in the memory to subract one of it

                  1. @azizhakberdiev 5y

                    No, you can, but you will instantly lose precision

        2. @RiedleroD 5y

          you're just describing how floats work here, no? and BigInts.

        3. Deleted Account 5y

          may i introduce you to Haskell Integer type

        4. @cheapgemmer 5y

          there is also BigNumber (bn.js)

  8. @taterdzai 5y

    If this integer was unsigned it would be allways correct

Use J and K for navigation