Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/apd v3 upgrade #4

Merged
merged 4 commits into from
Jul 18, 2024
Merged

Feat/apd v3 upgrade #4

merged 4 commits into from
Jul 18, 2024

Conversation

amimart
Copy link
Member

@amimart amimart commented Jul 18, 2024

Ship the latest v3.2.1 version of https://github.com/cockroachdb/apd used in float decimal implementation.

Also removes unused atoms & improve float documentation.

@amimart amimart self-assigned this Jul 18, 2024
Copy link

coderabbitai bot commented Jul 18, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes primarily involve the removal of trigonometric and mathematical function definitions from engine/atom.go and the update of the apd package import path across multiple files to apd/v3. Additionally, a comment for the Float struct in engine/float.go was expanded for clarity, and a test output in interpreter_test.go was adjusted for precision.

Changes

Files Change Summary
engine/atom.go Removed atoms for trigonometric and mathematical functions (acos, asin, atan, atan2, cos, sin, tan, round, sign, e).
engine/float.go, engine/number.go, engine/number_test.go Updated apd package import path from github.com/cockroachdb/apd to github.com/cockroachdb/apd/v3.
engine/float.go Expanded comment for Float struct to clarify its purpose and usage with decimal128Ctx.
interpreter_test.go Modified test case "172" output from 1.0e-323 to 1.000000000000000000000000000000000e-323 for increased precision.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@amimart amimart requested review from ccamel and bdeneux July 18, 2024 09:14
Copy link
Contributor

@bdeneux bdeneux left a comment

Choose a reason for hiding this comment

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

👍

@amimart amimart marked this pull request as ready for review July 18, 2024 09:43
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4735815 and 74443d8c61254643e6af58c5d3a8d798ff74e0db.

Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
Files selected for processing (5)
  • engine/atom.go (4 hunks)
  • engine/float.go (1 hunks)
  • engine/number.go (1 hunks)
  • engine/number_test.go (1 hunks)
  • interpreter_test.go (1 hunks)
Additional comments not posted (17)
engine/float.go (2)

5-5: LGTM! Updated import path.

The import path for the apd library has been correctly updated to v3.


10-16: LGTM! Improved documentation.

The updated documentation for the Float struct provides better clarity on its purpose, usage, and precision.

engine/atom.go (1)

Line range hint 1-1:
Verify the removal of trigonometric and mathematical atoms.

The atoms related to trigonometric functions (acos, asin, atan, atan2, cos, sin, tan) and mathematical operations (round, sign, e) have been removed. Ensure that this removal is intentional and check if there are any replacements or alternatives provided.

engine/number.go (1)

5-5: LGTM! Updated import path.

The import path for the apd library has been correctly updated to v3.

engine/number_test.go (12)

Line range hint 11-19:
LGTM!

The function newFloatFromFloat64Must correctly converts a float64 to a Float type using the apd.Decimal type.


Line range hint 21-28:
LGTM!

The function newFloatFromStringMust correctly converts a string to a Float type using the NewFloatFromString function.


Line range hint 30-38:
LGTM!

The function mulMust correctly multiplies two Float types using the mulF function.


Line range hint 40-309:
LGTM!

The function TestIs contains comprehensive test cases for various mathematical operations and edge cases.


Line range hint 311-351:
LGTM!

The function TestEqual contains comprehensive test cases for various equality checks.


Line range hint 353-380:
LGTM!

The function TestNotEqual contains comprehensive test cases for various inequality checks.


Line range hint 382-408:
LGTM!

The function TestLessThan contains comprehensive test cases for various less than comparisons.


Line range hint 410-436:
LGTM!

The function TestGreaterThan contains comprehensive test cases for various greater than comparisons.


Line range hint 438-464:
LGTM!

The function TestLessThanOrEqual contains comprehensive test cases for various less than or equal to comparisons.


Line range hint 466-492:
LGTM!

The function TestGreaterThanOrEqual contains comprehensive test cases for various greater than or equal to comparisons.


Line range hint 494-520:
LGTM!

The mockNumber struct and its methods are correctly implemented for mocking number operations in tests.


5-5: Verify compatibility with the new apd version.

The import path has been updated to github.com/cockroachdb/apd/v3. Ensure that the new version is compatible with the existing code and does not introduce any breaking changes.

interpreter_test.go (1)

609-609: Verify the precision of the modified output value.

The output value in test case "172" has been changed from 1.0e-323 to 1.000000000000000000000000000000000e-323. Ensure that this change accurately reflects the expected precision and behavior of the apd library.

Copy link
Member

@ccamel ccamel left a comment

Choose a reason for hiding this comment

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

Lgtm.

Just a point, commit f28ae49b0d1253800774f80d0f0db4d1b9d3ff60 has a typo.

@amimart amimart force-pushed the feat/apd-v3-upgrade branch from 74443d8 to f8e2298 Compare July 18, 2024 10:14
@amimart amimart merged commit d1e096f into main Jul 18, 2024
1 check passed
@amimart amimart deleted the feat/apd-v3-upgrade branch July 18, 2024 10:17
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.

3 participants