use !isnan() && !isinf instead of isnormal()