Add the pi constant word - #579
Conversation
Mirrors e (LibOpE): LibOpPi with integrity (0 in, 1 out), run pushing the constant, and referenceFn; registered in LibAllStandardOps between mul and power (72 -> 73 ops). The coefficient is pi rounded to nearest at 66 places, the same packing as FLOAT_E. #535 rebased onto the split library; the interpreter bytecode consequence is rainlang.deploy's next bump and release. Closes #225. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QyCCzi9WZPhuXcU1hwr2bq
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughAdds the ChangesPi opcode
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This adds a pi constant word that evaluates to the expected float value while rejecting invalid operands and arities. The implementation and registry behavior are covered, with no concrete current-head merge risk identified. Sequence Diagram(s)sequenceDiagram
participant I_INTERPRETER
participant LibAllStandardOps
participant LibOpPi
participant Stack
I_INTERPRETER->>LibAllStandardOps: resolve pi opcode
LibAllStandardOps->>LibOpPi: execute registered run function
LibOpPi->>Stack: push FLOAT_PI
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
The other tests compare the op to the literal; this one compares the literal to pi rounded to nearest at 66 places. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QyCCzi9WZPhuXcU1hwr2bq
|
Draft until |
The library defines it as of rain-math-float 0.2.1, exactly as FLOAT_E; the local literal and its packing test go, the library carries both. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QyCCzi9WZPhuXcU1hwr2bq
|
@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment: S/M/L PR Classification Guidelines:This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed. Small (S)Characteristics:
Review Effort: Would have taken 5-10 minutes Examples:
Medium (M)Characteristics:
Review Effort: Would have taken 15-30 minutes Examples:
Large (L)Characteristics:
Review Effort: Would have taken 45+ minutes Examples:
Additional Factors to ConsiderWhen deciding between sizes, also consider:
Notes:
|
Adds a
piconstant word, mirroringe(LibOpE). #535 rebased onto the split library:LibOpPi.sol, its registration inLibAllStandardOpsbetweenmulandpower(ALL_STANDARD_OPS_LENGTH72 -> 73, later word indices shift by one), andLibOpPi.t.sol.The word reads
LibDecimalFloat.FLOAT_PIfromrain-math-float0.2.1 (rain.math.float#274), exactly asereadsFLOAT_E. The library owns the constant and its checks:packLosslessof the 67-digit coefficient at -66 in Solidity, and π by Machin's formula in Rust bound to the library source. Nothing about the value is restated here.Stacked on #580 (the pin bump). Closes #225. Supersedes #535.
QA
LibOpPi.t.solparses_: pi();and evals toLibDecimalFloat.FLOAT_PI, checksintegrity(0 in, 1 out), the disallowed operand, and bad input / output arity;LibAllStandardOps.t.solpinspiat word index 59 with every later word shifted. 14 tests across those suites pass over the new pins; the full suite is on Pin rain-math-float 0.2.1 and rain-math-float-deploy 0.1.2 #580.runreturningFLOAT_Einstead ofFLOAT_PIfailstestOpPiRunagainstreferenceFn; the registration is pinned by the word-order test (drop thepientry and index 59 readspower).piword; delivered as theeword is built, with no value carried in rainlang.🤖 Generated with Claude Code
https://claude.ai/code/session_01QyCCzi9WZPhuXcU1hwr2bq