You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2011/01/21 22:17:43 UTC

[jira] Updated: (MATH-493) FastMath min and max fail with (Infinity,-Infinity) and (0,0, -0.0)

     [ https://issues.apache.org/jira/browse/MATH-493?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated MATH-493:
----------------------

    Description: 
FastMath min and max fail with (Infinity,-Infinity) and (0,0, -0.0):

min(float 0.0, float -0.0) expected -0.0 actual 0.0
min(float Infinity, float -Infinity) expected -Infinity actual NaN
max(float 0.0, float -0.0) expected 0.0 actual -0.0
max(float Infinity, float -Infinity) expected Infinity actual NaN

Similarly for the double versions.

The Infinity failures are because the code uses Float.isNaN(a + b) which gives NaN when +/1- Infinity are added together.

  was:
FastMath min and max fail with (Infinity,-Infinity) and (0,0, -0.0):

min(float 0.0, float -0.0) expected -0.0 actual 0.0
min(float Infinity, float -Infinity) expected -Infinity actual NaN
max(float 0.0, float -0.0) expected 0.0 actual -0.0
max(float Infinity, float -Infinity) expected Infinity actual NaN

Similarly for the double versions.

The Infinity failures are because the code uses Float.isNaN(a + b) which gives NaN when +/1- Infinity are added together.

The zero failures are less obvious - they agree with Math, but not with StrictMath.


> FastMath min and max fail with (Infinity,-Infinity) and (0,0, -0.0)
> -------------------------------------------------------------------
>
>                 Key: MATH-493
>                 URL: https://issues.apache.org/jira/browse/MATH-493
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 2.2, 3.0
>
>
> FastMath min and max fail with (Infinity,-Infinity) and (0,0, -0.0):
> min(float 0.0, float -0.0) expected -0.0 actual 0.0
> min(float Infinity, float -Infinity) expected -Infinity actual NaN
> max(float 0.0, float -0.0) expected 0.0 actual -0.0
> max(float Infinity, float -Infinity) expected Infinity actual NaN
> Similarly for the double versions.
> The Infinity failures are because the code uses Float.isNaN(a + b) which gives NaN when +/1- Infinity are added together.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.