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

Convert Number.round to Java #7360

Merged
merged 17 commits into from
Jul 26, 2023
Merged

Convert Number.round to Java #7360

merged 17 commits into from
Jul 26, 2023

Conversation

GregoryTravis
Copy link
Contributor

@GregoryTravis GregoryTravis commented Jul 20, 2023

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 added the CI: No changelog needed Do not require a changelog entry for this PR. label Jul 20, 2023
@GregoryTravis GregoryTravis linked an issue Jul 20, 2023 that may be closed by this pull request
@GregoryTravis GregoryTravis marked this pull request as ready for review July 20, 2023 20:02
@@ -0,0 +1,119 @@
package org.enso.base.math;

public class Math_Utils {
Copy link
Member

Choose a reason for hiding this comment

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

Once we have this, I assume we should be able to also get vectorized implementations for columns at basically no additional cost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll implement that in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I'll make a separate task for this.

if round_up then result_unnudged - scale else result_unnudged
# Don't check decimal_places here, it's checked in the Java.
Rounding_Helpers.check_round_input self <|
Math_Utils.roundLong self decimal_places use_bankers
Copy link
Member

Choose a reason for hiding this comment

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

roundLong may throw a IllegalArgumentException, but I don't see it being caught and converted to Enso error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted to the Enso integer round, since it was faster. So this is no longer used.

Copy link
Member

@jdunkerley jdunkerley 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 - will leave between you and Radek to include a vectorized column approach and as discussed worth looking at being a builtin.

@xvcgreg
Copy link

xvcgreg commented Jul 25, 2023

@GregoryTravis what is blocking this PR to be merged?

@GregoryTravis
Copy link
Contributor Author

It needs more varied benchmarks to be run to determine whether to use the Java or Enso implementations.

Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

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

What's the goal of this change? I've heard something about builtin during the standups. This is not a builtin, right?

The "less builtins the better", but still, I am a bit surprised.

@GregoryTravis
Copy link
Contributor Author

@JaroslavTulach yes, this is not a builtin. I will be benchmarking it as a builtin to see if there is any speed difference, but I wanted to get this in because there's a definite improvement for the decimal case.

@GregoryTravis GregoryTravis added the CI: Ready to merge This PR is eligible for automatic merge label Jul 26, 2023
@mergify mergify bot merged commit 628a51d into develop Jul 26, 2023
26 of 28 checks passed
@mergify mergify bot deleted the wip/gmt/7034-java-round branch July 26, 2023 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert Number.round to Java
6 participants