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

Add support for rounding negative decimal places #1689

Closed
wants to merge 1 commit into from

Conversation

jlabarbera11
Copy link
Member

@jlabarbera11 jlabarbera11 commented Oct 7, 2019

addresses #42

@ebyhr
Copy link
Member

ebyhr commented Oct 8, 2019

@jlabarbera11 Thanks for addressing this issue!
We are using this commit message guideline https://chris.beams.io/posts/git-commit and the commit message should start with uppercase and "decimal values" may be little misleading.

@jlabarbera11 jlabarbera11 changed the title add support for rounding negative decimal values Add support for rounding negative decimal places Oct 8, 2019
Copy link
Member

@findepi findepi left a comment

Choose a reason for hiding this comment

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

@jlabarbera11 thanks for working on this!

some comments


double factor = Math.pow(10, -decimals);
if (factor > Long.MAX_VALUE) {
throw new PrestoException(NUMERIC_VALUE_OUT_OF_RANGE, "decimal overflow: " + decimals);
Copy link
Member

Choose a reason for hiding this comment

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

this will need improvement, but i need to think about this yet

@findepi
Copy link
Member

findepi commented Oct 11, 2019

Merged as b91aeaf, thanks!

(i added 5 more test cases)

@findepi findepi closed this Oct 11, 2019
@findepi findepi added this to the 321 milestone Oct 11, 2019
@findepi findepi mentioned this pull request Oct 11, 2019
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants