groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: [1/2] groovy git commit: GROOVY-8679: BigDecimalMath.MAX_DIVISION_SCALE is hard-coded
Date Tue, 03 Jul 2018 10:10:25 GMT
Hi Daniel,

I think it is fine to make this configurable but I wouldn't change the
default.
That kind of breaking change is going to break lots of folk's builds.

Cheers, Paul.


On Tue, Jul 3, 2018 at 7:31 PM <sunlan@apache.org> wrote:

> Repository: groovy
> Updated Branches:
>   refs/heads/master 73b4a6f61 -> b7f609a96
>
>
> GROOVY-8679: BigDecimalMath.MAX_DIVISION_SCALE is hard-coded
>
>
> Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
> Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/94c9646b
> Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/94c9646b
> Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/94c9646b
>
> Branch: refs/heads/master
> Commit: 94c9646b7010ab7244ddb5fa8d729eef901ec5b7
> Parents: 73b4a6f
> Author: Pierre Pinon <pierre@pinon1.fr>
> Authored: Tue Jul 3 17:21:39 2018 +0800
> Committer: sunlan <sunlan@apache.org>
> Committed: Tue Jul 3 17:21:39 2018 +0800
>
> ----------------------------------------------------------------------
>  .../org/codehaus/groovy/runtime/typehandling/BigDecimalMath.java | 4 ++--
>  src/test/groovy/operator/BigDecimalOperatorsTest.groovy          | 4 ++--
>  .../codehaus/groovy/runtime/typehandling/NumberMathTest.groovy   | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/groovy/blob/94c9646b/src/main/java/org/codehaus/groovy/runtime/typehandling/BigDecimalMath.java
> ----------------------------------------------------------------------
> diff --git
> a/src/main/java/org/codehaus/groovy/runtime/typehandling/BigDecimalMath.java
> b/src/main/java/org/codehaus/groovy/runtime/typehandling/BigDecimalMath.java
> index 96bf0f3..6a7aaf5 100644
> ---
> a/src/main/java/org/codehaus/groovy/runtime/typehandling/BigDecimalMath.java
> +++
> b/src/main/java/org/codehaus/groovy/runtime/typehandling/BigDecimalMath.java
> @@ -30,11 +30,11 @@ public final class BigDecimalMath extends NumberMath {
>
>      // This is an arbitrary value, picked as a reasonable choice for a
> precision
>      // for typical user math when a non-terminating result would
> otherwise occur.
> -    public static final int DIVISION_EXTRA_PRECISION = 10;
> +    public static final int DIVISION_EXTRA_PRECISION = 32;
>
>      //This is an arbitrary value, picked as a reasonable choice for a
> rounding point
>      //for typical user math.
> -    public static final int DIVISION_MIN_SCALE = 10;
> +    public static final int DIVISION_MIN_SCALE = 32;
>
>      public static final BigDecimalMath INSTANCE = new BigDecimalMath();
>
>
>
> http://git-wip-us.apache.org/repos/asf/groovy/blob/94c9646b/src/test/groovy/operator/BigDecimalOperatorsTest.groovy
> ----------------------------------------------------------------------
> diff --git a/src/test/groovy/operator/BigDecimalOperatorsTest.groovy
> b/src/test/groovy/operator/BigDecimalOperatorsTest.groovy
> index ace3194..10be290 100644
> --- a/src/test/groovy/operator/BigDecimalOperatorsTest.groovy
> +++ b/src/test/groovy/operator/BigDecimalOperatorsTest.groovy
> @@ -90,10 +90,10 @@ class BigDecimalOperatorsTest extends GroovyTestCase {
>          assert y == 10 , "y = " + y
>
>          y = 34 / 3.000
> -        assert y == 11.3333333333 , "y = " + y
> +        assert y == 11.33333333333333333333333333333333 , "y = " + y
>
>          y = 34.00000000000 / 3
> -        assert y == 11.33333333333 , "y = " + y
> +        assert y == 11.33333333333333333333333333333333 , "y = " + y
>      }
>
>      BigDecimal echoX ( BigDecimal x, BigDecimal y) {x}
>
>
> http://git-wip-us.apache.org/repos/asf/groovy/blob/94c9646b/src/test/org/codehaus/groovy/runtime/typehandling/NumberMathTest.groovy
> ----------------------------------------------------------------------
> diff --git
> a/src/test/org/codehaus/groovy/runtime/typehandling/NumberMathTest.groovy
> b/src/test/org/codehaus/groovy/runtime/typehandling/NumberMathTest.groovy
> index eff11ce..5a92005 100644
> ---
> a/src/test/org/codehaus/groovy/runtime/typehandling/NumberMathTest.groovy
> +++
> b/src/test/org/codehaus/groovy/runtime/typehandling/NumberMathTest.groovy
> @@ -132,10 +132,10 @@ class NumberMathTest extends GroovyTestCase {
>          assert BI1.intdiv(BI2) == 0
>
>          assert I1 / I3 instanceof BigDecimal
> -        assert I1 / I3 == new BigDecimal("0.3333333333")
> +        assert I1 / I3 == new
> BigDecimal("0.33333333333333333333333333333333")
>
>          assert I2 / I3 instanceof BigDecimal
> -        assert I2 / I3 == new BigDecimal("0.6666666667")
> +        assert I2 / I3 == new
> BigDecimal("0.66666666666666666666666666666667")
>
>          assert I1 / BD2 instanceof BigDecimal
>
>
>

Mime
View raw message