Skip to content

Number of decimal places

4 messages · DMMS, David Winsemius, Rui Barradas

#
When estimating values ??each determined similarly, and in which get to them
by algebraic operations in some cases, are rounded with 0 decimal places and
in other cases with 2 or 3 decimal places. What is happening?
Thank you.



--
View this message in context: http://r.789695.n4.nabble.com/Number-of-decimal-places-tp4647549.html
Sent from the R help mailing list archive at Nabble.com.
#
For example
[1] 12344.57
[1] 234.567
[1] 1.111111e+20
[1] 11111111112
--
View this message in context: http://r.789695.n4.nabble.com/Number-of-decimal-places-tp4647549p4647552.html
Sent from the R help mailing list archive at Nabble.com.
#
Putting back the context:

( We are not looking at this with Nabble.)

        
On Oct 26, 2012, at 7:13 AM, DMMS wrote:

            
?options

Pay attention to digits and scipen arguments

Also look at:

 ?format
David Winsemius, MD
Alameda, CA, USA
#
Hello,

There might be another problem with some of the numbers in the example. 
R uses C's double numeric type and that means that the limit is around 
16 decimal digits of precision. One of the numbers has 23, so there will 
allways be loss of accuracy.


a <- 111111111111234235423.56
b <- 11111111111.898

print(a, digits = 23)  # only 16 digits are accurate (up to the second 2)
print(b, digits = 16)

  The number 'a' is too long for R.

Hope this helps,

Rui Barradas
Em 26-10-2012 17:02, David Winsemius escreveu: