There is an option in R
to control the number of digit displayed. As an example:
options(digits=5)
or if you are not a fan of scientific notation then:
options(digits = 999)
Most systems tend to have some default display precision built in, however that is different from the actual calculation as mentioned by @jogo. R
is no different from any of those systems when it comes to result rendition.
As far as the calculation is concerned, the base R
calculation will be sufficient for a most numbers you will deal with in day to day life, however, if you really want to be precise to n
decimals where n
can be typically greater than 15, I would suggest using gmp
, Rmpfr
or rcdd
packages.
EDIT
I just noticed your attempt at float
division. Certain language versions like python 2.xx have a different treatment of division when it comes to floats
vs integers
keeping the storage and computational efficiency in mind for the times it was written. This difference is now gone in the latest version. R
was built by statisticians for statisticians, so you can rest assured that when it comes to mathematical operations, the default treatment would be any different. Numbers are what they are -- numbers. Int
and float
are programmatic constructs, not mathematical ones.