Move zero-check to an earlier branch (#1906)

This commit is contained in:
jk-jeon 2020-09-29 06:24:53 -07:00 committed by GitHub
parent 90ef46df0b
commit 6f3536f974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2258,6 +2258,9 @@ FMT_SAFEBUFFERS decimal_fp<T> to_decimal(T x) FMT_NOEXCEPT {
(static_cast<carrier_uint>(1) << float_info<T>::significand_bits); (static_cast<carrier_uint>(1) << float_info<T>::significand_bits);
} else { } else {
// Subnormal case; the interval is always regular. // Subnormal case; the interval is always regular.
if (significand == 0) {
return decimal_fp<T>{0, 0};
}
exponent = float_info<T>::min_exponent - float_info<T>::significand_bits; exponent = float_info<T>::min_exponent - float_info<T>::significand_bits;
} }
@ -2307,10 +2310,6 @@ FMT_SAFEBUFFERS decimal_fp<T> to_decimal(T x) FMT_NOEXCEPT {
goto small_divisor_case_label; goto small_divisor_case_label;
} }
} }
if (ret_value.significand == 0) {
ret_value.exponent = 0;
return ret_value;
}
ret_value.exponent = minus_k + float_info<T>::kappa + 1; ret_value.exponent = minus_k + float_info<T>::kappa + 1;
// We may need to remove trailing zeros // We may need to remove trailing zeros