Commit f1bd6f77 authored by Junekey Jeon's avatar Junekey Jeon Committed by Victor Zverovich

Check r < deltai first, because that is the major branch chosen for short inputs

parent 5d8eb6a1
......@@ -2049,15 +2049,15 @@ template <typename T> decimal_fp<T> to_decimal(T x) noexcept {
uint32_t r = static_cast<uint32_t>(z_mul.result - float_info<T>::big_divisor *
ret_value.significand);
if (r > deltai) {
goto small_divisor_case_label;
} else if (r < deltai) {
if (r < deltai) {
// Exclude the right endpoint if necessary.
if (r == 0 && z_mul.is_integer && !include_right_endpoint) {
--ret_value.significand;
r = float_info<T>::big_divisor;
goto small_divisor_case_label;
}
} else if (r > deltai) {
goto small_divisor_case_label;
} else {
// r == deltai; compare fractional parts.
const carrier_uint two_fl = two_fc - 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment