Is there a way to tell if a function simply went out of range, or if the answer is actually infinity?

Code:
double i = 100. / 0.;  //inf
double oor = pow(9., 100.); //out of range