Implemented the 'checkFinite' function.