You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/08/21 09:24:11 UTC

[groovy] 11/11: Change to BigDecimal.ONE

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 7dc445c349b2da42d62db3cb97baca4251d268d3
Author: Bo Zhang <zh...@gmail.com>
AuthorDate: Tue Aug 20 15:58:26 2019 +0800

    Change to BigDecimal.ONE
---
 src/main/java/groovy/lang/ObjectRange.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/groovy/lang/ObjectRange.java b/src/main/java/groovy/lang/ObjectRange.java
index b78b193..19c585e 100644
--- a/src/main/java/groovy/lang/ObjectRange.java
+++ b/src/main/java/groovy/lang/ObjectRange.java
@@ -302,7 +302,7 @@ public class ObjectRange extends AbstractList<Comparable> implements Range<Compa
                 // let's fast calculate the size
                 final BigDecimal fromNum = new BigDecimal(from.toString());
                 final BigDecimal toNum = new BigDecimal(to.toString());
-                final BigInteger sizeNum = toNum.subtract(fromNum).add(BigDecimal.valueOf(1.0)).toBigInteger();
+                final BigInteger sizeNum = toNum.subtract(fromNum).add(BigDecimal.ONE).toBigInteger();
                 tempsize = sizeNum.intValue();
                 if (!BigInteger.valueOf(tempsize).equals(sizeNum)) {
                     tempsize = Integer.MAX_VALUE;