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/float as decimal #1

Merged
merged 9 commits into from
Jul 6, 2024
Merged

Feat/float as decimal #1

merged 9 commits into from
Jul 6, 2024

Conversation

amimart
Copy link
Member

@amimart amimart commented Jul 4, 2024

This PR brings changes in the behaviour of floats, by using under the hood arbitrary precision decimals following the GDA specification, using the https://github.com/cockroachdb/apd library.

Details

The change is motivated by two main reasons:

  • Determinism: floating point arithmetic can lead to determinism issues depending on the system architecture;
  • Approximation: floating point are approximate by essence, when playing with financial data like in a blockchain this can be problematic;

To avoid radical changes with the original prolog project I propose to change the behaviour of floating point by a decimal implementation instead of removing this type and introducing a new one.

The chosen implementation is a 128bits decimal with 34 digits of precision, mainly guided by the following issue: cosmos/cosmos-sdk#11783 on cosmos sdk.

Finally, for deterministic purpose, some integer arithmetic operations have also been changed using the same implementation.

Notable changes

Some changes are inherent to the use of decimal:

  • increased max/min float;
  • no overflow possible through addition as it is rounded;

Some functors have been removed because too difficult to implement:

  • sin
  • cos
  • tan
  • asin
  • acos
  • atan
  • atan2

Regarding solutions scanning, float types are no longer supported, the prolog float type is now marshalled as a string.

The possibility to provide float placeholders in prolog code has been removed.

Tests have been updated according to those changes.

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

coderabbitai bot commented Jul 4, 2024

Walkthrough

The changes mainly involve updating the implementation and handling of float values across different parts of the codebase. The old float operations using float64 were replaced with the apd package for arbitrary-precision decimal arithmetic. This includes modifying test cases, comparisons, and arithmetic operations to ensure more precise and accurate handling of numerical values. New helper functions and error handling mechanisms were also introduced to improve consistency and reliability.

Changes

File Change Summary
engine/atom_test.go Updated test cases to use NewFloatFromInt64 instead of Float.
engine/builtin_test.go Replaced Float with NewFloatFromInt64 and newFloatFromFloat64Must in various test cases.
engine/compound_test.go Modified comparison tests to use NewFloatFromInt64.
engine/env.go Added a new case to handle unification of Float and Integer types.
engine/float.go Changed Float to use apd.Decimal and added new functions for creating and handling Float values.
engine/float_test.go Replaced Float with NewFloatFromInt64 and newFloatFromFloat64Must in tests.
engine/integer_test.go Updated to use NewFloatFromInt64 for comparison between integers and floats.
engine/number.go Used apd package for precise calculations and updated various numerical functions.
engine/parser.go Changed the float handling approach in the Parser struct.
engine/parser_test.go Introduced assertEqualFloatAware for float comparison and updated test cases.
engine/stream_test.go Modified test cases to use NewFloatFromInt64.
engine/term_test.go Replaced Float(0) with NewFloatFromInt64(0).
engine/variable_test.go Updated float comparison to use NewFloatFromInt64(0).
interpreter_test.go Modified the foo predicate and related tests to use integer and string instead of float in some cases.
solutions.go Removed functions for float32 and float64 conversion and adjusted convertAssignAny.
solutions_test.go Refactored tests to use string instead of float in structs.

Sequence Diagrams

Since the changes primarily revolve around the internal handling of float values and updating test cases, creating a meaningful sequence diagram would not provide additional clarity. The modifications do not significantly alter the high-level control flow or introduce new features warranting sequence diagrams.


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 Configration 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 marked this pull request as ready for review July 4, 2024 14:24
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: 1

Outside diff range and nitpick comments (1)
engine/float.go (1)

Line range hint 76-90:
Formatting logic in WriteTerm is correct but could be optimized.

The function correctly formats the Float value, but the multiple Write calls could be combined to improve performance.

-	_, _ = ew.Write([]byte(" "))
-	_, _ = ew.Write([]byte("("))
-	_, _ = ew.Write([]byte(s))
-	_, _ = ew.Write([]byte(")"))
+	ew.Write([]byte(fmt.Sprintf("%s(%s)%s", " ", s, ")")))
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 03d3d3d and dd60a95.

Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
Files selected for processing (17)
  • engine/atom_test.go (1 hunks)
  • engine/builtin_test.go (16 hunks)
  • engine/compound_test.go (1 hunks)
  • engine/env.go (1 hunks)
  • engine/float.go (2 hunks)
  • engine/float_test.go (3 hunks)
  • engine/integer_test.go (1 hunks)
  • engine/number.go (22 hunks)
  • engine/number_test.go (10 hunks)
  • engine/parser.go (2 hunks)
  • engine/parser_test.go (6 hunks)
  • engine/stream_test.go (1 hunks)
  • engine/term_test.go (1 hunks)
  • engine/variable_test.go (1 hunks)
  • interpreter_test.go (6 hunks)
  • solutions.go (3 hunks)
  • solutions_test.go (5 hunks)
Files not summarized due to errors (1)
  • engine/number_test.go: Error: Message exceeds token limit
Additional context used
golangci-lint
engine/number.go

12-12: var oneFloat is unused

(unused)

Additional comments not posted (75)
engine/term_test.go (1)

49-49: Approved: Correct integration of NewFloatFromInt64.

The change from Float(0) to NewFloatFromInt64(0) aligns with the new float handling logic.

engine/integer_test.go (1)

49-49: Approved: Correct integration of NewFloatFromInt64.

The change from Float(1) to NewFloatFromInt64(1) aligns with the new float handling logic.

engine/float_test.go (3)

10-10: Approved: Correct integration of NewFloatFromInt64.

The change ensures that NewFloatFromInt64(0) correctly implements the Number interface.


20-24: Approved: Correct integration of newFloatFromFloat64Must.

The changes ensure that float values are correctly created and formatted using newFloatFromFloat64Must.


46-52: Approved: Correct integration of NewFloatFromInt64.

The changes ensure that float values are correctly compared using NewFloatFromInt64.

engine/atom_test.go (1)

54-54: Approved: Correct integration of NewFloatFromInt64.

The change from Float(1.0) to NewFloatFromInt64(1) aligns with the new float handling logic.

engine/variable_test.go (1)

50-50: Change looks good.

The change from Float(0) to NewFloatFromInt64(0) is consistent with the new implementation using apd.Decimal.

engine/float.go (16)

4-5: Import statements are appropriate.

The addition of the apd library is necessary for the new decimal implementation.


11-16: Good documentation and struct definition.

The comments clearly explain the rationale behind the new Float type, and the struct definition is straightforward.


18-24: Context initialization is appropriate.

The decimal128Ctx initialization is consistent with the requirements for arbitrary precision decimals.


26-33: Constructor for Float from string is well-implemented.

The function correctly initializes a Float from a string and handles errors appropriately.


35-40: Constructor for Float from int64 is well-implemented.

The function correctly initializes a Float from an int64.


42-69: Error handling for decimal conditions is comprehensive.

The function covers all possible error conditions and maps them to appropriate error values.


113-117: Comparison logic for Float is correct.

The function correctly compares Float values using apd.Decimal's comparison method.


119-121: String representation for Float is correct.

The function correctly returns the string representation of the Float value.


123-125: Negative check for Float is correct.

The function correctly checks if the Float value is negative.


127-129: Positive check for Float is correct.

The function correctly checks if the Float value is positive.


131-133: Zero check for Float is correct.

The function correctly checks if the Float value is zero.


135-137: Equality check for Float is correct.

The function correctly checks if two Float values are equal.


139-141: Greater than check for Float is correct.

The function correctly checks if one Float value is greater than another.


143-145: Greater than or equal check for Float is correct.

The function correctly checks if one Float value is greater than or equal to another.


147-149: Less than check for Float is correct.

The function correctly checks if one Float value is less than another.


151-153: Less than or equal check for Float is correct.

The function correctly checks if one Float value is less than or equal to another.

engine/env.go (1)

309-317: Unification logic for Float and Integer is correct.

The function correctly handles unification of Float and Integer types, ensuring the new decimal implementation is used.

solutions.go (1)

144-148: Conversion logic for engine.Float to string is correct.

The function correctly converts engine.Float to string, ensuring the new decimal implementation is used.

engine/compound_test.go (1)

76-76: Ensure consistency in float handling.

The change from Float(1) to NewFloatFromInt64(1) is consistent with the new float handling logic. Ensure that all instances of float usage in the tests are updated similarly.

solutions_test.go (4)

85-87: Ensure correct float handling and string conversion.

The change from Float(1) to NewFloatFromInt64(1) and the conversion of the result to a string is consistent with the new float handling logic. Ensure that similar changes are applied throughout the codebase.


228-233: Ensure correct float handling and string conversion in example.

The change from float64 to string for the float field in the example is consistent with the new float handling logic. Ensure that similar changes are applied throughout the codebase.


247-254: Ensure correct float handling and string conversion in tagged example.

The change from float64 to string for the float field in the tagged example is consistent with the new float handling logic. Ensure that similar changes are applied throughout the codebase.


270-277: Ensure correct float handling and string conversion in list example.

The change from float64 to string for the float field in the list example is consistent with the new float handling logic. Ensure that similar changes are applied throughout the codebase.

engine/parser_test.go (7)

12-22: Ensure equality assertion for new float handling.

The assertEqualFloatAware function ensures that the new float handling logic is correctly compared in tests. This is a good addition to handle the new apd.Decimal type.


84-87: Ensure correct float handling in parser term tests.

The change from Float(1.0) to NewFloatFromInt64(1) and similar changes are consistent with the new float handling logic. Ensure that similar changes are applied throughout the codebase.


182-191: Ensure correct float handling in parser term tests.

The usage of assertEqualFloatAware ensures correct comparison of floats in the parser term tests. This is consistent with the new float handling logic.


210-218: Ensure correct float handling in parser replace tests.

The change from float64 to NewFloatFromInt64 and newFloatFromFloat64Must is consistent with the new float handling logic. Ensure that similar changes are applied throughout the codebase.


224-225: Ensure correct float handling in parser replace tests.

The change from float64 to NewFloatFromInt64 and newFloatFromFloat64Must is consistent with the new float handling logic. Ensure that similar changes are applied throughout the codebase.


236-242: Ensure correct argument handling in parser replace tests.

The test cases for handling too few and too many arguments ensure that the parser correctly handles placeholder replacements. This is consistent with the new float handling logic.


292-295: Ensure correct float handling in parser number tests.

The change from float64 to newFloatFromFloat64Must is consistent with the new float handling logic. Ensure that similar changes are applied throughout the codebase.

engine/stream_test.go (1)

82-82: Ensure consistency in float handling.

The change from Float(1) to NewFloatFromInt64(1) is consistent with the new float handling logic. Ensure that all instances of float usage in the tests are updated similarly.

engine/parser.go (1)

806-808: LGTM! But verify the usage of NewFloatFromString.

The changes correctly handle the negative sign and create a new float from the string representation.

However, ensure that NewFloatFromString is used correctly throughout the codebase.

Verification successful

Verified: Correct usage of NewFloatFromString

The function NewFloatFromString is used correctly in the following locations:

  • engine/parser.go: Ensures the string has the correct sign before conversion.
  • engine/number.go: Initializes a constant value.
  • engine/number_test.go: Part of a test utility function that panics if the conversion fails.

All usages align with the function's purpose of converting a string to a Float type.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `NewFloatFromString` to ensure it is used correctly throughout the codebase.

# Test: Search for the function usage. Expect: Correct usage of `NewFloatFromString`.
rg --type go $'NewFloatFromString'

Length of output: 318


Script:

#!/bin/bash
# Extract the relevant code snippets to verify the correct usage of `NewFloatFromString`.

# Extract 10 lines before and after the usage in parser.go
rg --type go -A 10 -B 10 'NewFloatFromString' engine/parser.go

# Extract 10 lines before and after the usage in number.go
rg --type go -A 10 -B 10 'NewFloatFromString' engine/number.go

# Extract 10 lines before and after the usage in number_test.go
rg --type go -A 10 -B 10 'NewFloatFromString' engine/number_test.go

# Extract the function definition from float.go
rg --type go -A 20 -B 0 'func NewFloatFromString' engine/float.go

Length of output: 2038

engine/number.go (6)

Line range hint 770-785:
LGTM!

The changes correctly use the NewFloatFromInt64 function to handle mixed mode operations in the max function.


Line range hint 808-823:
LGTM!

The changes correctly use the NewFloatFromInt64 function to handle mixed mode operations in the min function.


608-619: LGTM! But verify the usage of decimal128Ctx.Exp.

The changes correctly use the apd library for arbitrary-precision decimal arithmetic in the exp function.

However, ensure that decimal128Ctx.Exp is used correctly throughout the codebase.


582-603: LGTM! But verify the usage of decimal128Ctx.Pow.

The changes correctly use the apd library for arbitrary-precision decimal arithmetic in the power function.

However, ensure that decimal128Ctx.Pow is used correctly throughout the codebase.


624-639: LGTM! But verify the usage of decimal128Ctx.Ln.

The changes correctly use the apd library for arbitrary-precision decimal arithmetic in the log function.

However, ensure that decimal128Ctx.Ln is used correctly throughout the codebase.

Verification successful

Verify the definition and context of decimal128Ctx.

The usage of decimal128Ctx.Ln is found only once in the codebase. Ensure that decimal128Ctx is correctly defined and used in the engine/number.go file.


Verify the definition of decimal128Ctx in the entire codebase.

The decimal128Ctx is used multiple times in the engine/number.go file, but its definition is not shown. Ensure that decimal128Ctx is correctly defined and used throughout the codebase.


Verify the definition and configuration of decimal128Ctx in engine/float.go.

The decimal128Ctx is defined as a variable of type apd.Context in engine/float.go. Ensure that it is correctly configured and used.


Verified: The usage of decimal128Ctx.Ln is correct.

The decimal128Ctx is correctly defined and configured in engine/float.go with appropriate precision and exponent range for arbitrary-precision decimal arithmetic. The usage of decimal128Ctx.Ln in engine/number.go is correct.

  • decimal128Ctx configuration:
    • Precision: 34
    • MaxExponent: 6144
    • MinExponent: -6143
    • Traps: apd.DefaultTraps
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `decimal128Ctx.Ln` to ensure it is used correctly throughout the codebase.

# Test: Search for the function usage. Expect: Correct usage of `decimal128Ctx.Ln`.
rg --type go $'decimal128Ctx.Ln'

Length of output: 89


Script:

#!/bin/bash
# Description: Verify the definition and context of `decimal128Ctx` in the engine/number.go file.

# Search for the definition of `decimal128Ctx` in the engine/number.go file.
rg --type go 'decimal128Ctx' engine/number.go

Length of output: 657


Script:

#!/bin/bash
# Description: Verify the definition of `decimal128Ctx` in the entire codebase.

# Search for the definition of `decimal128Ctx` in the entire codebase.
rg --type go 'decimal128Ctx'

Length of output: 1023


Script:

#!/bin/bash
# Description: Review the definition and configuration of `decimal128Ctx` in `engine/float.go`.

# Display the definition of `decimal128Ctx` in the `engine/float.go` file.
rg --type go --context 10 'var decimal128Ctx = apd.Context' engine/float.go

Length of output: 759


644-659: LGTM! But verify the usage of decimal128Ctx.Sqrt.

The changes correctly use the apd library for arbitrary-precision decimal arithmetic in the sqrt function.

However, ensure that decimal128Ctx.Sqrt is used correctly throughout the codebase.

Verification successful

Verify the usage of decimal128Ctx.Sqrt in engine/number.go.

The search results show that decimal128Ctx.Sqrt is only used in engine/number.go. Ensure this function is used correctly by examining the context and related imports.


Verify the complete import section in engine/number.go.

The context of the sqrt function appears correct, but it's essential to confirm that decimal128Ctx is properly imported and initialized.


Verify the initialization of decimal128Ctx in engine/number.go.

The apd package is correctly imported. Next, ensure that decimal128Ctx is properly initialized.


Verify the initialization of decimal128Ctx in the codebase.

The search results show multiple usages of decimal128Ctx functions but do not indicate its initialization. Ensure that decimal128Ctx is properly initialized by searching the entire codebase.


Verified: Correct usage of decimal128Ctx.Sqrt.

The decimal128Ctx is properly initialized in engine/float.go and used correctly in engine/number.go.

  • engine/float.go: Initialization of decimal128Ctx as an apd.Context variable.
  • engine/number.go: Correct usage of decimal128Ctx.Sqrt.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `decimal128Ctx.Sqrt` to ensure it is used correctly throughout the codebase.

# Test: Search for the function usage. Expect: Correct usage of `decimal128Ctx.Sqrt`.
rg --type go $'decimal128Ctx.Sqrt'

Length of output: 93


Script:

#!/bin/bash
# Description: Verify the context and correctness of `decimal128Ctx.Sqrt` usage in `engine/number.go`.

# Display the surrounding lines of the usage to understand the context.
rg --context 10 --type go 'decimal128Ctx.Sqrt' engine/number.go

# Check the imports in the file to ensure `decimal128Ctx` is properly imported and initialized.
rg --type go 'import' engine/number.go

Length of output: 538


Script:

#!/bin/bash
# Description: Gather the complete import section from `engine/number.go` to ensure `decimal128Ctx` is properly imported and initialized.

# Display the complete import section.
rg --type go --context 20 '^import' engine/number.go

Length of output: 522


Script:

#!/bin/bash
# Description: Verify the initialization of `decimal128Ctx` in `engine/number.go` to ensure it is correctly set up.

# Search for the initialization of `decimal128Ctx`.
rg --type go 'decimal128Ctx' engine/number.go

Length of output: 657


Script:

#!/bin/bash
# Description: Verify the initialization of `decimal128Ctx` in the codebase to ensure it is correctly set up.

# Search for the initialization of `decimal128Ctx`.
rg --type go 'decimal128Ctx'

Length of output: 1023

engine/number_test.go (10)

14-22: LGTM!

The newFloatFromFloat64Must function is correctly implemented, converting a float64 to a Float using apd.Decimal with proper error handling.


24-31: LGTM!

The newFloatFromStringMust function is correctly implemented, converting a string to a Float using NewFloatFromString with proper error handling.


33-40: LGTM!

The mulMust function is correctly implemented, multiplying two Float values using mulF with proper error handling.


Line range hint 44-245:
LGTM!

The test cases in TestIs have been correctly updated to use NewFloatFromInt64 and newFloatFromFloat64Must, ensuring they align with the new float handling logic.


292-306: LGTM!

The test cases in TestEqual have been correctly updated to use NewFloatFromInt64, ensuring they align with the new float handling logic.


339-341: LGTM!

The test cases in TestNotEqual have been correctly updated to use NewFloatFromInt64, ensuring they align with the new float handling logic.


366-368: LGTM!

The test cases in TestLessThan have been correctly updated to use NewFloatFromInt64, ensuring they align with the new float handling logic.


393-395: LGTM!

The test cases in TestGreaterThan have been correctly updated to use NewFloatFromInt64, ensuring they align with the new float handling logic.


420-422: LGTM!

The test cases in TestLessThanOrEqual have been correctly updated to use NewFloatFromInt64, ensuring they align with the new float handling logic.


447-449: LGTM!

The test cases in TestGreaterThanOrEqual have been correctly updated to use NewFloatFromInt64, ensuring they align with the new float handling logic.

interpreter_test.go (4)

727-727: Verify the correctness of replacing float with integer.

The test case has been modified to use an integer instead of a float. Ensure that this change aligns with the intended behavior and does not affect the test's validity.


772-772: Verify the correctness of replacing float with string.

The test case has been modified to use a string instead of a float. Ensure that this change aligns with the intended behavior and does not affect the test's validity.


791-791: Verify the correctness of replacing float with string.

The test case has been modified to use a string instead of a float. Ensure that this change aligns with the intended behavior and does not affect the test's validity.


795-795: Verify the correctness of replacing float with string.

The test case has been modified to use a string instead of a float. Ensure that this change aligns with the intended behavior and does not affect the test's validity.

engine/builtin_test.go (16)

402-402: LGTM!

The change from Float(1) to NewFloatFromInt64(1) aligns with the PR objective of using arbitrary precision decimals.


456-456: LGTM!

The change from Float(1) to NewFloatFromInt64(1) aligns with the PR objective of using arbitrary precision decimals.


518-518: LGTM!

The change from Float(1.0) to newFloatFromFloat64Must(1.0) aligns with the PR objective of using arbitrary precision decimals.


635-636: LGTM!

The changes from Float(1.1) and Float(1.5) to newFloatFromFloat64Must(1.1) and newFloatFromFloat64Must(1.5) align with the PR objective of using arbitrary precision decimals.

Also applies to: 643-643


785-785: LGTM!

The change from Float(1.1) to newFloatFromFloat64Must(1.1) aligns with the PR objective of using arbitrary precision decimals.


2107-2108: LGTM!

The changes from Float(3.0) to newFloatFromFloat64Must(3.0) align with the PR objective of using arbitrary precision decimals.


5526-5526: LGTM!

The change from Float(1.23) to newFloatFromFloat64Must(1.23) aligns with the PR objective of using arbitrary precision decimals.


5871-5871: LGTM!

The change from Float(23.4) to newFloatFromFloat64Must(23.4) aligns with the PR objective of using arbitrary precision decimals.


5882-5882: LGTM!

The change from Float(23.4) to newFloatFromFloat64Must(23.4) aligns with the PR objective of using arbitrary precision decimals.


5895-5895: LGTM!

The change from Float(23.4) to newFloatFromFloat64Must(23.4) aligns with the PR objective of using arbitrary precision decimals.


5904-5904: LGTM!

The changes from Float(3.3) to newFloatFromFloat64Must(3.3) align with the PR objective of using arbitrary precision decimals.

Also applies to: 5910-5910


6020-6020: LGTM!

The changes from Float(33.0) to newFloatFromFloat64Must(33.0) align with the PR objective of using arbitrary precision decimals.

Also applies to: 6023-6023


6037-6037: LGTM!

The changes from Float(4.2) to newFloatFromFloat64Must(4.2) align with the PR objective of using arbitrary precision decimals.

Also applies to: 6040-6040


7165-7166: LGTM!

The change from Float(1) to NewFloatFromInt64(1) aligns with the PR objective of using arbitrary precision decimals.


7188-7189: LGTM!

The change from Float(1) to NewFloatFromInt64(1) aligns with the PR objective of using arbitrary precision decimals.


7209-7210: LGTM!

The change from Float(0) to newFloatFromFloat64Must(0) aligns with the PR objective of using arbitrary precision decimals.

engine/number.go Outdated Show resolved Hide resolved
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 dd60a95 and bf4ef2a.

Files selected for processing (1)
  • engine/number.go (22 hunks)
Files skipped from review as they are similar to previous changes (1)
  • engine/number.go

Copy link

@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.

Wonderful 😍 ! LGTM, Good job ! 👍

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.

👍

@amimart amimart merged commit 0e87b1e into main Jul 6, 2024
1 check passed
@amimart amimart deleted the feat/float-as-decimal branch July 6, 2024 12:45
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