top | item 27069364

(no title)

CharlieMunger | 4 years ago

Discussed here, with a screenshot of Google failing:

https://old.reddit.com/r/brkb/comments/n6bjws/integer_overfl...

Berkshire is overflowing a 32-bit unsigned integer representation. When an unsigned integer exceeds its maximum representable value, it wraps around starting at zero.

If you add 1 to the maximum, you get 0. If you add 2 to the maximum, you get 1. If you add 3 to the maximum, you get 2. If you add 4 to the maximum, you get 3. And so on. The number wraps around to zero (it's modulo 2^32).

They're using a 4-byte (i.e., 32-bit) unsigned integer to represent the price in terms of ten-thousandths of a dollar.

For example, the standard size of an "unsigned int" in C on most modern systems is 32 bits. The maximum value you can express in a 32-bit unsigned integer is 32 one-bits:

1111 1111 1111 1111 1111 1111 1111 1111

This binary number is two to the power of 32, minus 1 (i.e., 2^32 - 1) which is, in decimal:

4,294,967,295

This integer represents $429,496.7295 because the price is specified in ten-thousandths of a dollar.

The Berkshire A-share (BRK.A) exceeded that price.

The B-share (BRK.B) equivalent price is $286.33 (divide A-share price by 1,500).

discuss

order