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

Use MathContext in BigDecimal operations #6884

Merged
merged 1 commit into from
Jul 6, 2018

Conversation

gmethvin
Copy link
Contributor

@gmethvin gmethvin commented Jul 3, 2018

Since a BigDecimal contains a MathContext, one would expect that to be used for all the operators where the Java API allows it. Currently that is not always the case. This adds the MathContext to all operations where it makes sense to use it, passing it along as an extra parameter to the Java method.

I believe this makes sense because we are already doing it for * and /, and it appears the MathContext was omitted from the others for no particular reason.

Fixes scala/bug#10882.

@scala-jenkins scala-jenkins added this to the 2.13.0-M5 milestone Jul 3, 2018
Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

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

I'm no BigDecimal/MathContext expert, but this looks good and straightforward to me.

@dwijnand dwijnand merged commit 4a5af09 into scala:2.13.x Jul 6, 2018
@dwijnand
Copy link
Member

dwijnand commented Jul 6, 2018

Thanks Greg.

@SethTisue
Copy link
Member

SethTisue commented Feb 6, 2021

This is a breaking change that we should have release-noted. I added it to the 2.13.0 release notes just now. (People are still upgrading from 2.12.)

There is further discussion on scala/bug#11590 and scala/bug#11152 (and if you keep chasing links, perhaps elsewhere as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
4 participants