commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [commons-numbers] branch master updated: Ensure "long" arithmetics.
Date Fri, 29 Nov 2019 13:24:07 GMT
This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git


The following commit(s) were added to refs/heads/master by this push:
     new 4860e9d  Ensure "long" arithmetics.
4860e9d is described below

commit 4860e9d7b134650d738c51670d432221903104a8
Author: Gilles Sadowski <gilles@harfang.homelinux.org>
AuthorDate: Fri Nov 29 14:23:21 2019 +0100

    Ensure "long" arithmetics.
    
    Reported by "sonarcloud.io".
---
 .../src/main/java/org/apache/commons/numbers/fraction/BigFraction.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/BigFraction.java
b/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/BigFraction.java
index 6484611..3821496 100644
--- a/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/BigFraction.java
+++ b/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/BigFraction.java
@@ -726,7 +726,7 @@ public final class BigFraction
          * exponent, we also need to add the exponent bias.
          */
         final int exponentBias = (1 << (exponentLength - 1)) - 1;
-        long exponent = numRightShift - denRightShift + quotRightShift + significandLength
+ exponentBias;
+        long exponent = (long) numRightShift - denRightShift + quotRightShift + significandLength
+ exponentBias;
         final long maxExponent = (1L << exponentLength) - 1L; //special exponent for
infinities and NaN
 
         if (exponent >= maxExponent) { //infinity


Mime
View raw message