commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "GG (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MATH-1457) FastMath.exp() generates java.lang.ArrayIndexOutOfBoundsException: length=1025; index=333726400
Date Fri, 27 Apr 2018 12:51:00 GMT
GG created MATH-1457:
------------------------

             Summary: FastMath.exp() generates java.lang.ArrayIndexOutOfBoundsException: length=1025;
index=333726400
                 Key: MATH-1457
                 URL: https://issues.apache.org/jira/browse/MATH-1457
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.6.1
         Environment: Android Oreo 8.1
            Reporter: GG


Using Apache FastMath v3.6.1 in my Android project. The OS is Android Oreo 8.1. Got this exception:

{{java.lang.ArrayIndexOutOfBoundsException: length=1025; index=333726400}}
{{        at org.apache.commons.math3.util.FastMath.exp(FastMath.java:936)}}
{{        at org.apache.commons.math3.util.FastMath.exp(FastMath.java:864)}}

 

Noticed this for the first (and only) time. Most of the time the function works okay, so unable
to reproduce it with some specific numbers.

 

Incriminated part of the code:

{color:#3f7f5f}/* Get the fractional part of x, find the greatest multiple of 2^-10 less than
{color}{color:#3f7f5f} * x and look up the exp function of it.
{color}{color:#3f7f5f} * fracPartA will have the upper 22 bits, fracPartB the lower 52 bits.
{color}{color:#3f7f5f} */
{color}{color:#7f0055}final int {color}{color:#6a3e3e}intFrac {color}= ({color:#7f0055}int{color})
((x - {color:#6a3e3e}intVal{color}) * {color:#0000ff}1024.0{color});
{color:#7f0055}**HERE -->>> final double {color}{color:#6a3e3e}fracPartA {color}=
ExpFracTable.{color:#0000c0}EXP_FRAC_TABLE_A{color}[{color:#6a3e3e}intFrac{color}];
{color:#7f0055}final double {color}{color:#6a3e3e}fracPartB {color}= ExpFracTable.{color:#0000c0}EXP_FRAC_TABLE_B{color}[{color:#6a3e3e}intFrac{color}];

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message