Skip to content

Conversation

@szeiger
Copy link
Contributor

@szeiger szeiger commented Dec 11, 2018

Fixes scala/bug#11152, supersedes #7236,
reverts #6884 ...and repeats 3a1332c

This reverts commit ace11c0.

We did the same thing before in 3a1332c
to avoid problems such as scala/bug#4981
(back then) and scala/bug#11152 (now).
@scala-jenkins scala-jenkins added this to the 2.13.0-RC1 milestone Dec 11, 2018
@plokhotnyuk
Copy link
Contributor

plokhotnyuk commented Dec 11, 2018

Down voted because it reverts infinite loops on simple +, -, etc. ops. scala/bug#10882

@Ichoran Ichoran self-assigned this Jan 10, 2019
Copy link
Contributor

@Ichoran Ichoran left a comment

Choose a reason for hiding this comment

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

This isn't a viable strategy. The bug fixed in #6884 is a bug. Furthermore, if we don't care about math contexts, we shouldn't go to all the trouble of wrapping them together with BigDecimal and instead just provide extension methods for Java's versions. For example, you would expect that (2*x)/2 gives the same answer as (x + x)/2, but that isn't true with this reversion. (Even IEEE754, which is chock-full of surprises, isn't that surprising.)

That we in the past decided against using MathContexts for some operations in order to fix bugs elsewhere is not necessarily an indication that we should do so again.

I think instead that this is pointing that the idea of MathContext itself does not actually follow the principle of least surprise, and/or that NumericRange should know about BigDecimal and program defensively so that if it could possibly work it will work.

Note that BigDecimal(1) / BigDecimal(3) gives OOM if we don't use MathContext at all, which is pretty bad. So we need to address it somehow; I just don't think this is it--not in this simple of a form, anyway.

I'll discuss more options on scala/bug#11152.

@Ichoran
Copy link
Contributor

Ichoran commented Jan 23, 2019

I don't think reversion (alone) is enough, because it leaves surprising resource-gobbling behavior bugs in place (in contrast to expectation if you set precision). Feel free to reopen with a fix for that. Or I have an alternate way to fix scala/bug#11152 that solves that problem.

@Ichoran Ichoran closed this Jan 23, 2019
@SethTisue SethTisue removed this from the 2.13.0-RC1 milestone Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants