Avoid unspecified behaviour for infinite values.