To represent a number that has a decimal point, like 3.2, you use a `floating-point number`. There are two things to bear in mind about floating-point numbers.
First, in computers floating-point numbers are stored as a `mantissa` and an `exponent`, similar to how you write a number in scientific notation.
For example, 123.45 could be stored as something like 1.2345 x 10^{2} or 12.345 x 10^{1} (although the computer will use base 2 instead of base 10).
Additionally, floating-point numbers are often imprecise: There are many numbers that cannot be stored with perfect accuracy in a floating-point number. The computer will store a very close approximation to the number you expect. (More on that in a moment.)

Swift has two ...

Start Free Trial

No credit card required