Properly compare Inf and NaN
Properly compare Inf and NaN

AMICI-developer/AMICI,FFroehlich/AMICI,FFroehlich/AMICI,AMICI-developer/AMICI,FFroehlich/AMICI,AMICI-developer/AMICI,AMICI-developer/AMICI,FFroehlich/AMICI