It's because you have the line:


private static double NaN;

Then the value for that is never set and you start to return that value even though you never set it to anything. Also please use...