0

I am facing a problem in converting long (19-digits) characters to numeric. After conversion they are transformed in an unpredictable manner. Why does the number change after 10th position in the character?

options(scipen=100000, digits=22)
a = '9440006300200000000'
class(a) 
[1] "character"
nchar(a) 
[1] 19
a_numeric = as.numeric(a)
a_numeric 
[1] 9440006300199999488
class(a_numeric)
[1] "numeric"
nchar(a_numeric)
[1] 19
spazm
  • 4,399
  • 31
  • 30

0 Answers0