-
Notifications
You must be signed in to change notification settings - Fork 326
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
Conversation
@@ -0,0 +1,119 @@ | |||
package org.enso.base.math; | |||
|
|||
public class Math_Utils { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
@GregoryTravis what is blocking this PR to be merged? |
It needs more varied benchmarks to be run to determine whether to use the Java or Enso implementations. |
There was a problem hiding this 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.
@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. |
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.