Skip to content

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

@MichaelChirico

Description

@MichaelChirico
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions