static bool IsNaN(object x) { return (x is double && Double.IsNaN((double)x)) || (x is float && float.IsNaN((float)x)); }