Skip to content

Error in rational -> float conversion #390

@snunez1

Description

@snunez1
CL-USER> (lisp-implementation-version)
"Version 1.11.8 (v1.11.8-2-gd411e378) WindowsX8664"
CL-USER> (float 41107100000541273/100000000000)
411071.03

Hmm. If you work out the decimal points, the float is: 411071.00000541273, that's a long way from .03

Maybe coerce? Nope, that's even worse:

CL-USER> (coerce 41107100000541273/100000000000 'double-float)
411071.03125D0

Interestingly, taking one digit off the rational produces a correct result:

CL-USER> (float 4110710000054127/10000000000)
411071.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions