I have a function that calculates a variable of type double. Sometimes when the inputs to the function change drastically it will generate a Nan value into the double variable. I have tried to account for this condition with a try - catch block, but it does not seem to work for Nan. Is there a way to compare for Nan condition like the Jave isNan method?