...

/

Floating Point Types Usage and Limitations

Floating Point Types Usage and Limitations

In this lesson, you will learn how to choose an appropriate type of the floating point and some limitations of these types.

Which floating type to use #

Unless there is a specific reason to choose otherwise, you can choose double for floating point values. float has lower precision than double and real, but it takes less number of bits and can be useful when we have limited memory. On the other hand, since the precision of real is higher than double on some hardware, it would be preferable for high precision calculations.

Limitations #

Let’s discuss a few limitations that we have with the floating point types.

Cannot represent all values #

It is impossible to represent some values in our daily life. In the decimal system that we use daily the digits before the decimal point represent ones, tens, hundreds, etc., and the digits after the decimal point represent tenths, hundredths, thousandths, etc. If ...