Last time I promised a blog about Pythagoras. That was a long time ago because I kept getting distracted by writing Pluralsight courses and – well – basically things that – unlike this blog – actually earn me money! But I really should honour my promises so… Continue reading “Pythagoras? Easy Peasy!”

# Category: Math

# A Strange Binary Pattern

While I was writing the Maths for Programmers course, I was constructing some examples to illustrate overflow and noticed a strange pattern. I was working with the number 255, which is the biggest number that can be stored in an unsigned byte, and is represented in binary by 1111 1111. The idea was to use the unsigned byte data type and show the results of calculating 255 + 255 and 255 * 255 – both of those will cause an overflow.

Now 255 + 255 gives 510. And 255 * 255 gives 65,025. Look at what these numbers look like in binary. Continue reading “A Strange Binary Pattern”