srb633
srb633

Reputation: 813

Exceed the 7 digit decimal limit for numeric values in R?

Just noticed that R limits numeric values to 7 digits below the decimal. I'm needing to calculate and output numeric values of down to 16 digits. Is it possible to exceed the supposed 7 digit decimal limit in R?

As you can see in the example below, it won't output any digits below 7.

> 0.6431159420289856
[1] 0.6431159

Desired output of course is

> 0.6431159420289856
[1] 0.6431159420289856

My particular use case requires those values to be outputted.

Upvotes: 1

Views: 327

Answers (1)

Greg
Greg

Reputation: 3660

You can change the decimal places displayed with options(digits = 16) to get your requested output. That said, R will do math on all the digits available, regardless of the options setting for decimal places.

options(digits = 16)    
0.6431159420289856
[1] 0.6431159420289856

Upvotes: 2

Related Questions