Skip to content

Preserve integer precision in ordering comparisons #17

Closed

Description

@qoke

Ordering comparisons have the same precision problem as equality: converting large integers to float64 can make distinct values indistinguishable.

{{ 9007199254740992 < 9007199254740993 }}
{{ 9007199254740993 > 9007199254740992.0 }}

Both expressions should return:

True
True

The integer values are within the supported range. The precision is being lost during comparison.

I’ll open a PR shortly that keeps integer–integer comparisons in integer arithmetic and handles mixed integer–float comparisons separately. The mixed path accounts for floating-point bounds and fractional values without converting the integer operand to a rounded float.

I'll raise PR and include regression tests for both examples, and I’ll link it back to this issue.

Activity

  1. ardan-bkennedy commented on Oct 26, 2026

    @ardan-bkennedy
    Contributor

    Resolved in #34 and published in v1.11.0, with corresponding regression tests covering the reported problem. Thank you, @qoke, for the report and suggested solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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