문제

> x <- 1.00042589212565
> x
[1] 1.000426

If I wanted to print the exact value of x, how would I do it?

Sorry if this is a dumb question. I tried Googling for "R" and "exact" or "round" but all I get are articles about how to round.

Thank you in advance!

도움이 되었습니까?

해결책

Globally solution during all the session

options(digits=16)
> x
[1] 1.00042589212565

or locally just for x:

sprintf("%.16f", x)
[1] "1.0004258921256499"

다른 팁

print(x, digits=15)

or

format(x, digits=15)

or

sprintf("%.14f", x)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top