Ch2.2.2 Floating Point Numbers
Floating Point Numbers
- Floating point numbers provide the way around the limitations of binary integers.
- Floating point numbers are capable of storing noninteger values, such as
2.71828182845905, 3.14159265358979, and 0.25.
- How many significant digits shown below?

Floating Point Numbers
- Floating point numbers provide the way around the limitations of binary integers.
- Floating point numbers are capable of storing noninteger values, such as
2.71828182845905, 3.14159265358979, and 0.25.
- How many significant digits shown below? (Ans = 5)

Floating Point Numbers
- Floating point numbers can store much larger numbers.
- R defaults to storing numerical data as floating point data.
2^31
[1] 2147483648
2^30
[1] 1073741824
Floating Point Numbers: Double Precision
- There are several standards for floating point.
- We focus on double precision, or just double.
- It has approximately double the storage space (64 bits) than standard floating point format (32 bits).

Floating Point Numbers: Double Precision
- Compare with single precision.

Floating Point Numbers: Single Precision
- Compare with single precision.
- See next slide for more details.

Floating Point Numbers: Single Precision
- Exponent range split to allow for positive and negative exponents on base.
- Thus exponent on 2 has “-127” for this reason
256/2
[1] 128
Floating Point Numbers: Single Precision
- The C float data type is sometimes called single precision.
- R includes a function to convert a number to a single precision value.
- Underlying data type within R is still double precision.
- R can interact with languages that support single precision data types.