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

Decimal remainder, pow, div #9566

Merged
merged 11 commits into from
Mar 28, 2024
Merged

Decimal remainder, pow, div #9566

merged 11 commits into from
Mar 28, 2024

Conversation

GregoryTravis
Copy link
Contributor

@GregoryTravis GregoryTravis commented Mar 27, 2024

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@GregoryTravis GregoryTravis marked this pull request as ready for review March 27, 2024 17:46
Comment on lines 529 to 530
Remainder in Enso will undergo automatic conversions such that you need
not convert other numeric types to `Decimal` manually.
Copy link
Member

Choose a reason for hiding this comment

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

This sounds to me like the result of the operation will undergo conversions, which as far as I understand is not the case and you mean the arguments, right?

Maybe we can rephrase it to make it clearer?

Suggested change
Remainder in Enso will undergo automatic conversions such that you need
not convert other numeric types to `Decimal` manually.
Arguments of the `remainder` operation will undergo automatic conversions such that you need
not convert other numeric types to `Decimal` manually.

maybe something like that?

  1. I don't think you need to say in Enso there - this is an Enso library so that is rather assumed,
  2. IMO it's good to point you mean arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 498 to 507
+ [[5, 3, 2], [5.0, 3.0, 2.0], [3.5, 2, 1.5], [10.5, 1.0, 0.5], [3, 1, 0], [3.0, 1.0, 0]]
+ [[-5, 3, -2], [-5.0, 3.0, -2.0], [-3.5, 2, -1.5], [-10.5, 1.0, -0.5], [-3, 1, 0], [-3.0, 1.0, 0]]
+ [["9223372036854775807", 10, 7], ["9223372036854775808", 10, 8], ["922337203685477580000000000008", 10, 8]]
+ [["-9223372036854775808", 10, -8], ["-9223372036854775809", 10, -9], ["-922337203685477580000000000008", 10, -8]]
cases.map c->
base = c.at 0
modulus = c.at 1
residue = c.at 2
(Decimal.new base % modulus) . should_equal residue
(Decimal.new base % Decimal.new modulus) . should_equal residue
Copy link
Member

Choose a reason for hiding this comment

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

I'd probably add a test case for something like 2.7 % 0.5. Should it work and return 0.2 or are non-integer arguments not allowed? Either way it would be good to have a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

@radeusgd radeusgd left a comment

Choose a reason for hiding this comment

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

Looks good, just some small comments

@GregoryTravis GregoryTravis added CI: Ready to merge This PR is eligible for automatic merge and removed CI: Ready to merge This PR is eligible for automatic merge labels Mar 28, 2024
@mergify mergify bot merged commit f80e3f3 into develop Mar 28, 2024
42 checks passed
@mergify mergify bot deleted the wip/gmt/8982-div-mod-pow branch March 28, 2024 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants