Permalink
Browse files

Checking for NaN value of "double" type has been fixed.

A condition 
    doubleVal == Double.NaN 
will return FALSE every time.

There is an explanation at the Stackoverflow: http://stackoverflow.com/a/8819776
  • Loading branch information...
1 parent 06ac702 commit 2494780be7a35c9b4647eb150c2f8a44274faf25 @alexandrklimov alexandrklimov committed Jul 12, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/main/java/in/satpathy/financial/XIRR.java
@@ -75,7 +75,7 @@ public static double xirr( XIRRData xirrData ) {
}
System.out.println( "XIRR Result - " + result ) ;
- return (result != Double.NaN) ? (result - 1) : result ;
+ return (Double.isNaN(result)) ? (result - 1) : result ;
yingrong
yingrong Nov 18, 2014

if result is 1.131 , it return 1.131;
if result is Double.NaN , it return NaN.

ept
ept Nov 18, 2014 Owner

I think you got the condition the wrong way round.

}
-} /* End of the XIRR class. */
+} /* End of the XIRR class. */

0 comments on commit 2494780

Please sign in to comment.