Skip to content

Cross-reference FLOAT_E against e derived in Rust, read through e() - #20

Closed
thedavidmeister wants to merge 1 commit into
mainfrom
2026-09-07-constant-getters
Closed

Cross-reference FLOAT_E against e derived in Rust, read through e()#20
thedavidmeister wants to merge 1 commit into
mainfrom
2026-09-07-constant-getters

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Adds Float::e(), which calls the concrete's e() and so returns LibDecimalFloat.FLOAT_E from the compiled library, and a Rust cross-reference of that value: e derived by the 1/k! series in 512-bit integer arithmetic with 12 guard digits, rounded to nearest at 66 places, asserted equal to the getter's return both by pack_lossless of the derived coefficient and by Float::parse of the derived digits through the contract's parser. No literal is mirrored in Rust; what is checked is the library's Solidity, reached through the concrete.

FLOAT_PI (rain.math.float#274) takes the same path in a follow-up once that release is pinned here and the concrete exposes pi() beside e(). That getter moves DecimalFloat's bytecode, so it is its own change.

QA

  • Discriminating tests: e_is_e_rounded_to_nearest and e_parses_from_its_digits; a one-ulp change to FLOAT_E in the library fails both, and the series is independent of the library's digits.
  • Mutations applied: n/a, a getter wrapper and tests.
  • Oracle: the exponential series evaluated in integers; no floating point and no copied digits.
  • Category check: the ask was a Rust cross-reference bound to the Solidity constants; this is the binding for e, and the pattern π follows.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QyCCzi9WZPhuXcU1hwr2bq

Float::e() calls the concrete's e(), which returns
LibDecimalFloat.FLOAT_E, so the check reaches the library's Solidity
rather than a copied literal. e is derived by the 1/k! series in
512-bit integer arithmetic with guard digits, rounded to nearest at 66
places, and asserted equal both by pack_lossless and through the
contract's parser. FLOAT_PI follows the same path once the library
release carrying it is pinned here and the concrete exposes pi().

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QyCCzi9WZPhuXcU1hwr2bq
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 530b34cb-e005-4217-b2bd-8f8645a63339

📥 Commits

Reviewing files that changed from the base of the PR and between 8f1f4ca and ff22fea.

📒 Files selected for processing (2)
  • crates/float/src/constants.rs
  • crates/float/src/lib.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thedavidmeister

Copy link
Copy Markdown
Contributor Author

Withdrawn: the cross-reference belongs in rain.math.float beside the constants; it lands there on rain.math.float#274.

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.

1 participant