The Wayback Machine - https://web.archive.org/web/20210117093214/https://github.com/ThinkR-open/seven31
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
img
 
 
man
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

R FAQ 7.31

is probably the most famous FAQ, so it deserves its own πŸ“¦ to help you πŸ•΅οΈ the confusion of

0.3 + 0.6 == 0.9
#> [1] FALSE
sqrt(2)^2 == 2
#> [1] FALSE

This wikipedia article is a good introduction to the Double-precision floating-point format, but in short double (what we call numeric in R) are encoded in 64 bits:

  • the first bit is the sign bit
  • the 11 following bits are the exponent
  • the remaining 52 bits are the fraction

Installation

From github:

devtools::install_github( "ThinkR-open/seven31" )

Reveal the bits

reveal πŸ” the binary representation of numbers. It takes a variadic number of arguments and shows their representation. On a πŸ– compatible environment, you get a nice colored output:

Compare two numbers

compare shows the differences. On πŸ– compatible environments, the bits that differ between the two numbers are highlighted with πŸ”΄ background.

About

R πŸ“¦ for R FAQ 7.31

Topics

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.