3.3 Dealing with integer and floating point numbers
- Doing math with integer is always safe
## [1] 2147483647
## Warning in .Machine$integer.max + 1L: NAs produced by integer overflow
## [1] NA
- Floating point number are “limited”: 8 bytes
## [1] 0.1234567891123456856439
Hence:
## [1] FALSE
What can we do!
round
is an usual trickthe author likes
abs(x - y) < very_small_number
## [1] TRUE