windows 7 - how to keep floating point precision in R? -


i assign floating point number variable in r.

e.g.

k <- 1200.0000002161584854 

i got

 > k  [1] 1200  > k+0.00000001  [1] 1200 

how keep precision of k ?

i have read posts here, but, not find solution.

in addition above answers, notice value of k different assigned it. have 15 or 16 digits of precision (most of time more need).

k <- 1200.0000002161584854 sprintf('%1.29f',k)  "1200.00000021615846890199463814497" 

note there libraries can increase precision, such gmp, designed around integers.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -