Is there a function to detect if a number is numeric, i.e., not NaN or INF?
Yes, it is.
You can use:
double.IsInfinity()
double.IsNaN()
double.IsnegativeInfinity()
double.IsPositiveInfinity()
You have to pass the number you want to test as a parameter to these methods. The parameters should have type double. But, as I know, if you pass an int, it will automatically cast to a double anyway.