19 Jul 2013 amatus   » (Journeyer)

Why $92,233,720,368,547,800? In binary that's 101000111101011100001010001111010111000010100011111011000...

Why $92,233,720,368,547,800?
In binary that's 101000111101011100001010001111010111000010100011111011000. That's a 20-bit pattern that almost repeats 3 times. If we add three leading zeroes we get a nice even 60 bits and the boundaries of the pattern can be shifted without any trouble, then fix the last 7 bits to fit the pattern we get 92,233,720,368,547,758. Was this the actual sum and it got rounded before being reported by BBC? Maybe Mr. Reynolds had the extra $42 already in his account. What does this 20-bit pattern mean? 10100011110101110000
Let's try IEEE floating point format. In binary scientific notation the number is 2^56 * 1.01000111101011100001010001111010111000010100011111011_2. The mantissa is one bit too long to fit in the double-precision format. If we truncate that bit our new number is 92,233,720,368,547,790 and the binary representation is 0100001101110100011110101110000101000111101011100001010001111101. The exponent doesn't follow the nice pattern we have in the mantissa and no sane person would store monetary values in a lossy format like this, so this looks like a dead-end.
Back to the 20-bit pattern. We could Google search all 20 rotations of this pattern for clues, but the very first search turns up a plausible result. This pattern is the repeating bits of the binary expansion of 1/100 and would appear in the floating point representation. This suggests that somewhere in PayPal's code, one penny turned into $92 quadrillion because a floating point number was interpreted as an integer. If only my bank's software would make the same mistake.

PayPal in $92 quadrillion error

Syndicated 2013-07-18 14:24:12 from David Barksdale - Google+ Posts

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!