Take a close look at the implementation of System.Double (use Reflector or any other dissassembler).
Look, for example, at the following excerpt:
public const double PositiveInfinity = (double)1.0 / (double)0.0;
public const double NaN = (double)1.0 / (double)0.0;
Huh?!?! What ?!!? Why ?!?!
Of course, I had to run and check:
double myNaN = double.NaN;
bool isInf = (double.IsPositiveInfinity(myNaN));
// isInf is set to FALSE
double myInf = double.PositiveInfinity;
bool isNaN = (double.IsNaN(myInf));
// isNaN is set to FALSE
It doesn't end there. Look at the implementation of IsNaN:
public static bool IsNaN(double d)
{
return (d != d);
}
All'n'all, I must confess I can't make any sense of all this!
I promise to publish if/when I do.
No comments:
Post a Comment