diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index faeaf6c..c1a49b5 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -25,7 +25,7 @@ jobs: - name: Build run: cmake --build build --parallel - name: Test - run: ctest --test-dir build --parallel + run: ctest --test-dir build --parallel --output-on-failure cmake-macos-x86_64: runs-on: macos-12 timeout-minutes: 15 @@ -36,7 +36,7 @@ jobs: - name: Build run: cmake --build build --config Release --parallel -- -quiet - name: Test - run: ctest --test-dir build --build-config Release --parallel + run: ctest --test-dir build --build-config Release --parallel --output-on-failure cmake-macos-arm64: runs-on: macos-14 timeout-minutes: 15 @@ -47,7 +47,7 @@ jobs: - name: Build run: cmake --build build --config Release --parallel -- -quiet - name: Test - run: ctest --test-dir build --build-config Release --parallel + run: ctest --test-dir build --build-config Release --parallel --output-on-failure cmake-windows-x86: runs-on: windows-2019 timeout-minutes: 15 @@ -55,10 +55,12 @@ jobs: - uses: actions/checkout@v4 - name: Configure run: cmake -Bbuild -S. -G "Visual Studio 16 2019" -A Win32 -DFP16_BUILD_COMPARATIVE_BENCHMARKS=ON + env: + CXXFLAGS: "/arch:IA32" - name: Build run: cmake --build build --config Release --parallel - name: Test - run: ctest --test-dir build --build-config Release --parallel + run: ctest --test-dir build --build-config Release --parallel --output-on-failure cmake-windows-x64: runs-on: windows-2019 timeout-minutes: 15 @@ -69,7 +71,7 @@ jobs: - name: Build run: cmake --build build --config Release --parallel - name: Test - run: ctest --test-dir build --build-config Release --parallel + run: ctest --test-dir build --build-config Release --parallel --output-on-failure cmake-windows-arm64: runs-on: windows-2019 timeout-minutes: 15 diff --git a/include/fp16/fp16.h b/include/fp16/fp16.h index 2b61fff..fe5d28d 100644 --- a/include/fp16/fp16.h +++ b/include/fp16/fp16.h @@ -228,7 +228,8 @@ static inline uint16_t fp16_ieee_from_fp32_value(float f) { const float scale_to_inf = fp32_from_bits(UINT32_C(0x77800000)); const float scale_to_zero = fp32_from_bits(UINT32_C(0x08800000)); #endif - float base = (fabsf(f) * scale_to_inf) * scale_to_zero; + const float saturated_f = fabsf(f) * scale_to_inf; + float base = saturated_f * scale_to_zero; const uint32_t w = fp32_to_bits(f); const uint32_t shl1_w = w + w;