Skip to content

Extend integer range#116

Merged
raviqqe merged 12 commits into
mainfrom
chore/refactor-operate
Jul 7, 2026
Merged

Extend integer range#116
raviqqe merged 12 commits into
mainfrom
chore/refactor-operate

Conversation

@raviqqe

@raviqqe raviqqe commented Jul 6, 2026

Copy link
Copy Markdown
Owner

No description provided.

@codspeed-hq

codspeed-hq Bot commented Jul 6, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 29.76%

⚡ 9 improved benchmarks
❌ 3 regressed benchmarks
✅ 29 untouched benchmarks
⏩ 10 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
f62_add_float 289.6 µs 298 µs -2.84%
f62_add_mixed 303.9 µs 312.3 µs -2.71%
f62_sub_float 239.6 µs 245.2 µs -2.28%
f62_mul_integer_overflow 348 µs 106.1 µs ×3.3
f62_add_integer_overflow 189.5 µs 103.4 µs +83.34%
sum_f62 103.3 µs 75.5 µs +36.83%
f62_neg_integer 103.3 µs 81.1 µs +27.49%
f62_add_integer 131.1 µs 103.4 µs +26.85%
f62_sub_integer 131.1 µs 103.4 µs +26.85%
f62_mul_integer 133.9 µs 106.1 µs +26.17%
f62_rem_integer 189.8 µs 176 µs +7.89%
f62_checked_rem_integer 201 µs 187.1 µs +7.42%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing chore/refactor-operate (cb3b604) with main (90ec932)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@raviqqe raviqqe changed the title Refactor operation Extend integer range Jul 6, 2026
@raviqqe
raviqqe marked this pull request as ready for review July 6, 2026 16:00
Copilot AI review requested due to automatic review settings July 6, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Float62 NaN-boxing implementation to expand the effective integer handling range and adjusts arithmetic behavior and tests accordingly.

Changes:

  • Removes the prior “upgrade to float when integer math overflows / exceeds a limit” path and makes from_integer directly box integers.
  • Simplifies integer arithmetic by routing Add/Sub/Mul through a single operate! macro using wrapping operations.
  • Updates tests to use a larger INTEGER_LIMIT (1 << 62) and aligns arithmetic reference expectations with wrapping behavior.
Comments suppressed due to low confidence (1)

src/f62.rs:433

  • The unit tests currently don't cover the 63-bit integer boundary behavior implied by box_integer/unbox_integer. Adding explicit assertions around [-2^62, 2^62-1] and out-of-range inputs would catch silent corruption cases like Float62::from_integer(1<<62) (which cannot be represented losslessly with integer<<1).

    const INTEGER_LIMIT: i64 = 1 << 62;

    #[test]
    fn integer() {
        assert!(is_integer(box_integer(0)));
        assert_eq!(unbox_integer(box_integer(0)), Some(0));
        assert_eq!(unbox_integer(box_integer(1)), Some(1));
        assert_eq!(unbox_integer(box_integer(-1)), Some(-1));
        assert_eq!(unbox_integer(box_integer(42)), Some(42));
        assert_eq!(unbox_integer(box_integer(-42)), Some(-42));

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/f62.rs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 6 comments.

Comment thread src/f62.rs
Comment thread src/f62.rs
Comment thread src/f62.rs
Comment thread src/f62.rs
Comment thread src/f62.rs
Comment thread src/f62.rs
@raviqqe
raviqqe merged commit 5cc30e0 into main Jul 7, 2026
13 of 14 checks passed
@raviqqe
raviqqe deleted the chore/refactor-operate branch July 7, 2026 01:18
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

Successfully merging this pull request may close these issues.

2 participants