Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numerical precision of log10.integer64() is not very satisfactory #48

Open
MichaelChirico opened this issue Oct 8, 2024 · 0 comments
Open

Comments

@MichaelChirico
Copy link
Collaborator

expect_identical(log10(as.integer64(c(1L, 10L, 100L, 1000L))), as.numeric(0:3))
# Error: log10(as.integer64(c(1L, 10L, 100L, 1000L))) (`actual`) not identical to as.numeric(0:3) (`expected`).
#
#     actual             | expected              
# [1] 0.0000000000000000 | 0.0000000000000000 [1]
# [2] 1.0000000000000000 | 1.0000000000000000 [2]
# [3] 2.0000000000000000 | 2.0000000000000000 [3]
# [4] 2.9999999999999996 - 3.0000000000000000 [4]

c.f. the equivalent for integer/numeric input:

expect_identical(log10(c(1, 10, 100, 1000)), as.numeric(0:3))    # pass
expect_identical(log10(c(1L, 10L, 100L, 1000L)), as.numeric(0:3) # pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant