mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
Merge pull request #175 from fastfloat/dlemire/broader_alpine
Trying to extend alpine CI to more systems and fixing legacy issue (x86)
This commit is contained in:
commit
f4efe3ccb0
56
.github/workflows/alpine.yml
vendored
56
.github/workflows/alpine.yml
vendored
@ -1,27 +1,47 @@
|
|||||||
name: Alpine Linux
|
name: Alpine Linux
|
||||||
'on':
|
on:
|
||||||
- push
|
- push
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ubuntu-build:
|
build:
|
||||||
|
name: Build on Alpine ${{ matrix.arch }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch:
|
||||||
|
- x86_64
|
||||||
|
- x86
|
||||||
|
- aarch64
|
||||||
|
- armv7
|
||||||
|
- ppc64le
|
||||||
|
- riscv64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout repository
|
||||||
- name: start docker
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Install latest Alpine Linux for ${{ matrix.arch }}
|
||||||
|
uses: jirutka/setup-alpine@v1
|
||||||
|
with:
|
||||||
|
arch: ${{ matrix.arch }}
|
||||||
|
branch: ${{ matrix.arch == 'riscv64' && 'edge' || 'latest-stable' }}
|
||||||
|
packages: >
|
||||||
|
build-base
|
||||||
|
cmake
|
||||||
|
g++
|
||||||
|
linux-headers
|
||||||
|
git
|
||||||
|
bash
|
||||||
|
build-base
|
||||||
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
docker run -w /src -dit --name alpine -v $PWD:/src alpine:latest
|
cmake -DFASTFLOAT_TEST=ON -B build
|
||||||
echo 'docker exec alpine "$@";' > ./alpine.sh
|
shell: alpine.sh {0}
|
||||||
chmod +x ./alpine.sh
|
- name: Build
|
||||||
- name: install packages
|
|
||||||
run: |
|
run: |
|
||||||
./alpine.sh apk update
|
cmake --build build
|
||||||
./alpine.sh apk add build-base cmake g++ linux-headers git bash
|
shell: alpine.sh {0}
|
||||||
- name: cmake
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
./alpine.sh cmake -DFASTFLOAT_TEST=ON -B build_for_alpine
|
ctest --test-dir build -R basictest
|
||||||
- name: build
|
shell: alpine.sh {0}
|
||||||
run: |
|
|
||||||
./alpine.sh cmake --build build_for_alpine
|
|
||||||
- name: test
|
|
||||||
run: |
|
|
||||||
./alpine.sh bash -c "cd build_for_alpine && ctest -R basictest"
|
|
||||||
|
|||||||
@ -66,6 +66,10 @@ from_chars_result parse_infnan(const char *first, const char *last, T &value) n
|
|||||||
* Credit : @mwalcott3
|
* Credit : @mwalcott3
|
||||||
*/
|
*/
|
||||||
fastfloat_really_inline bool rounds_to_nearest() noexcept {
|
fastfloat_really_inline bool rounds_to_nearest() noexcept {
|
||||||
|
// https://lemire.me/blog/2020/06/26/gcc-not-nearest/
|
||||||
|
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
// See
|
// See
|
||||||
// A fast function to check your floating-point rounding mode
|
// A fast function to check your floating-point rounding mode
|
||||||
// https://lemire.me/blog/2022/11/16/a-fast-function-to-check-your-floating-point-rounding-mode/
|
// https://lemire.me/blog/2022/11/16/a-fast-function-to-check-your-floating-point-rounding-mode/
|
||||||
|
|||||||
@ -132,7 +132,9 @@ TEST_CASE("rounds_to_nearest") {
|
|||||||
fesetround(FE_TONEAREST);
|
fesetround(FE_TONEAREST);
|
||||||
std::cout << "FE_TONEAREST: fmin + 1.0f = " << iHexAndDec(fmin + 1.0f) << " 1.0f - fmin = " << iHexAndDec(1.0f - fmin) << std::endl;
|
std::cout << "FE_TONEAREST: fmin + 1.0f = " << iHexAndDec(fmin + 1.0f) << " 1.0f - fmin = " << iHexAndDec(1.0f - fmin) << std::endl;
|
||||||
CHECK(fegetround() == FE_TONEAREST);
|
CHECK(fegetround() == FE_TONEAREST);
|
||||||
|
#if (FLT_EVAL_METHOD == 1) || (FLT_EVAL_METHOD == 0)
|
||||||
CHECK(fast_float::detail::rounds_to_nearest() == true);
|
CHECK(fast_float::detail::rounds_to_nearest() == true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("parse_zero") {
|
TEST_CASE("parse_zero") {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user