diff --git a/.github/workflows/ubuntu22-gcc13.yml b/.github/workflows/ubuntu24.yml similarity index 62% rename from .github/workflows/ubuntu22-gcc13.yml rename to .github/workflows/ubuntu24.yml index 990a620c..43a213fc 100644 --- a/.github/workflows/ubuntu22-gcc13.yml +++ b/.github/workflows/ubuntu24.yml @@ -4,20 +4,20 @@ on: [push, pull_request] jobs: ubuntu-build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v3 - name: Use cmake run: | mkdir build && cd build && - CXX=g++-13 CXXFLAGS=-Werror cmake -DFASTFLOAT_TEST=ON .. && + CXXFLAGS=-Werror cmake -DFASTFLOAT_TEST=ON .. && cmake --build . && ctest --output-on-failure - name: Use cmake CXX23 run: | mkdir build20 && cd build20 && - CXX=g++-13 CXXFLAGS=-Werror cmake -DFASTFLOAT_CONSTEXPR_TESTS=ON -DFASTFLOAT_FIXEDWIDTH_TESTS=ON -DFASTFLOAT_CXX_STANDARD=23 -DFASTFLOAT_TEST=ON .. && + CXXFLAGS=-Werror cmake -DFASTFLOAT_CONSTEXPR_TESTS=ON -DFASTFLOAT_FIXEDWIDTH_TESTS=ON -DFASTFLOAT_CXX_STANDARD=23 -DFASTFLOAT_TEST=ON .. && cmake --build . && ctest --output-on-failure \ No newline at end of file diff --git a/include/fast_float/decimal_to_binary.h b/include/fast_float/decimal_to_binary.h index fec916f3..a4e245be 100644 --- a/include/fast_float/decimal_to_binary.h +++ b/include/fast_float/decimal_to_binary.h @@ -127,8 +127,9 @@ adjusted_mantissa compute_float(int64_t q, uint64_t w) noexcept { // but in practice, we can win big with the compute_product_approximation if its additional branch // is easily predicted. Which is best is data specific. int upperbit = int(product.high >> 63); + int shift = upperbit + 64 - binary::mantissa_explicit_bits() - 3; - answer.mantissa = product.high >> (upperbit + 64 - binary::mantissa_explicit_bits() - 3); + answer.mantissa = product.high >> shift; answer.power2 = int32_t(detail::power(int32_t(q)) + upperbit - lz - binary::minimum_exponent()); if (answer.power2 <= 0) { // we have a subnormal? @@ -164,7 +165,7 @@ adjusted_mantissa compute_float(int64_t q, uint64_t w) noexcept { // To be in-between two floats we need that in doing // answer.mantissa = product.high >> (upperbit + 64 - binary::mantissa_explicit_bits() - 3); // ... we dropped out only zeroes. But if this happened, then we can go back!!! - if((answer.mantissa << (upperbit + 64 - binary::mantissa_explicit_bits() - 3)) == product.high) { + if((answer.mantissa << shift) == product.high) { answer.mantissa &= ~uint64_t(1); // flip it so that we do not round up } }