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

Inconsistent application of MathContext when creating BigDecimal #8116

Closed
scabug opened this issue Jan 6, 2014 · 3 comments
Closed

Inconsistent application of MathContext when creating BigDecimal #8116

scabug opened this issue Jan 6, 2014 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jan 6, 2014

BigDecimal can't make up its mind whether to round or not when given a java.math.MathContext:

scala> BigDecimal(123456789, new java.math.MathContext(5))
res8: scala.math.BigDecimal = 123456789

scala> BigDecimal(123456789L, new java.math.MathContext(5))
res9: scala.math.BigDecimal = 1.2346E+8

scala> BigDecimal(123456789f, new java.math.MathContext(5))
res10: scala.math.BigDecimal = 1.2346E+8

scala> BigDecimal(123456789d, new java.math.MathContext(5))
res11: scala.math.BigDecimal = 1.2346E+8

scala> BigDecimal(new java.math.BigDecimal(123456789d), new java.math.MathContext(5))
res12: scala.math.BigDecimal = 123456789

scala> BigDecimal.valueOf(123456789d, new java.math.MathContext(5))
res13: scala.math.BigDecimal = 123456789
@scabug
Copy link
Author

@scabug scabug commented Jan 6, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8116?orig=1
Reporter: @Ichoran
Affected Versions: 2.10.3, 2.11.0-M7

@scabug
Copy link
Author

@scabug scabug commented Jan 15, 2014

@scabug scabug closed this Jan 15, 2014
@scabug
Copy link
Author

@scabug scabug commented Jun 17, 2015

@SethTisue said:
see also scala/scala#4527

@scabug scabug added this to the 2.11.0-M8 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants