public static long compare(double self, object obj)
{
double that = (obj as Double).doubleValue();
if (System.Double.IsNaN(self))
{
return (System.Double.IsNaN(that)) ? 0 : -1;
}
else if (System.Double.IsNaN(that))
{
return +1;
}
else
{
if (self < that) return -1; return self == that ? 0 : +1;
}
}