Decimal places in a floating point number

Floating point numbers are a mainstay of programming in areas such as games, graphics, and simulation. On the whole, they are easy and intuitive to use. However, they have certain quirks and issues to be aware of. For example, their representation is inherently flexible and often approximate. This means there’s no definitive answer to the question of how many decimal places they can hold.

By looking at the way floating point numbers are stored, it’s possible to understand why this happens, and what precision is likely to be available. Hypothetically, it’s possible under certain circumstances to get up to about 45 decimal places in a C++ float, and 324 in a double. However, as we’ll see in this post, it depends on context.
Read more Decimal places in a floating point number

What is Standard Deviation?

The term “Standard Deviation” comes up quite a lot in certain types of research papers where statistics are mentioned. As a result, I have to wonder exactly what it tells us, why it is interesting, and how it works.

Thankfully the basic idea is fairly simple. You don’t need extensive training in statistics to understand what it means. In fact, I just picked up an old copy of a statistics textbook at a second-hand book shop and it told me everything I needed to know. Read more What is Standard Deviation?

Even Powers and Odd Numbers

This is a very simple mathematical relationship I found out about recently, which I rather like (although I don’t claim to be original… it’s probably been covered millions of times before!). Here’s an example:

12 = 1
22 = 4 = 1 + 3
32 = 8 = 1 + 3 + 5
42 = 16 = 1 + 3 + 5 + 7
52 = 25 = 1 + 3 + 5 + 7 + 9

You’ll notice that the square numbers are being formed by sums of consecutive odd numbers, starting at 1. I don’t have a mathematical proof for this (although I’m sure one exists), but it appears to work for any even power. I wrote a quick computer program to try the same with the 10th power, and sure enough, it works: Read more Even Powers and Odd Numbers