-
Notifications
You must be signed in to change notification settings - Fork 64
Update docs about round() function. #230
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
Update docs about round() function. #230
Conversation
|
Looks like you've updated the documentation! Check out your changes at https://neo4j-docs-cypher-230.surge.sh |
nadja-muller
left a comment
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 think this is a great improvement! I left some remarks where I think we could do even better 😁
JPryce-Aklundh
left a comment
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! I just have one question and one suggestion.
| == round(), with precision | ||
|
|
||
| `round()` returns the value of the given number rounded with the specified precision, with half-values always being rounded up. | ||
| `round()` returns the value of the given number rounded to the closest value of given precision, with ties always being rounded away from zero (rounding mode `HALF_UP`). |
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.
Could this instead read: (using rounding mode HALF_UP)
or
(the default rounding mode is HALF_UP)
| *Considerations:* | ||
| |=== | ||
|
|
||
| | For the rounding modes, a tie refers to that the two closest values of the given precision are on the same distance from the given value. |
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.
| | For the rounding modes, a tie refers to that the two closest values of the given precision are on the same distance from the given value. | |
| | For the rounding modes, a tie means that the two closest values of the given precision are at the same distance from the given value. |
We follow the behaviour of Java, i.e. rounding towards positive infinity for ties when we have no precision or mode or rounding according to https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/math/RoundingMode.html for rounding modes. The current description was wrong in some cases and missleading in others. Also added more examples.
- Better description of round(x, precision) - Better description of HALF_UP and HALF_DOWN - Semantic order instead of alphabetical
We follow the behaviour of Java, i.e. rounding towards positive infinity for ties when we have no precision or mode or rounding according to https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/math/RoundingMode.html for rounding modes.
The current description was wrong in some cases and missleading in others. Also added more examples.
Fixes #neo4j/neo4j#12972 and neo4j/neo4j#12963