Avoid integer overflow when checking fp validity