Floating Point Numbers Overview
The device you are reading this is likely to be a modern PC made within the past five years. Inside its CPU will be a co-processor called a floating point unit or FPU. The purpose of the FPU is to perform maths operations on floating point numbers. This is not an explanation of floating point numbers, Wikipedia will explain that for you.
So you might write this C code when working with non-integer numbers, it’s pretty standard code:
float a = 5.6; float b = 6.8; float h = sqrt(a * a + b * b);
Which on a modern CPU is a fast, efficient operation done in hardware. The compiler can optimise the code so the FPU in the processor performs these multiplications quickly.
Older CPUs up to the 486SX didn’t have FPUs, so while they could still work with floating point numbers, the operations on them had to be performed by the CPU, and these operations are quite processor intensive. On a modern multi-gigahertz CPU it wouldn’t matter, but on a machine running in single digit megahertz it is noticeably slow.
However, if you did any BASIC programming in the 80s you’re probably thinking “but I did programming with decimals and it was fine?”
10 PRINT 22/7
This will give you an answer with a decimal number. However this is because most BASIC languages worked with floating point numbers internally anyway, it was one reason BASIC was so slow.