Dear Po Su,

All floating point numbers in R have exactly the same number of binary digits 
(53) and therefore the same number of decimal digits (15.95, as decimals aren't 
represented exactly in binary). If you want to find out how many decimal digits 
are after the decimal point, you could try subtracting floor(log10(x)) from 16.
Anything else is pretty much futile - to the point of nonsensical. You can 
never have exact representation of all decimal fractions in a binary computer, 
and once you understand that you can see that the number of decimal digits you 
get from any character representation depends only on how much you decide to 
round when converting to character format. That is essentially arbitrary, so 
any games you play with conversion to character are just telling you how many 
digits you decided to round each number to, not how many there were to start 
with.


S Ellison




*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to