From 81bd9e220346b5b75cd624a6a829a78682e47e30 Mon Sep 17 00:00:00 2001 From: PrimedErwin <1973609350@qq.com> Date: Thu, 22 May 2025 16:57:03 +0800 Subject: [PATCH] fix linux_x64 --- 3rd/math/src/acos.c | 3 +-- CMakeLists.txt | 13 +++++++------ tests/93_deterministic_float.py | 1 - 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/3rd/math/src/acos.c b/3rd/math/src/acos.c index 21aa3233..ea9c87bf 100644 --- a/3rd/math/src/acos.c +++ b/3rd/math/src/acos.c @@ -97,6 +97,5 @@ double acos(double x) SET_LOW_WORD(df,0); c = (z-df*df)/(s+df); w = R(z)*s+c; - // return 2*(df+w); - return 999.9; + return 2*(df+w); } diff --git a/CMakeLists.txt b/CMakeLists.txt index bfe81793..8d2d16c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,11 +91,6 @@ else() endif() if(UNIX AND NOT APPLE) - if(NOT PK_ENABLE_DETERMINISTIC_FLOAT) - # use platform libm - target_link_libraries(${PROJECT_NAME} m) - endif() - if(PK_ENABLE_OS) target_link_libraries(${PROJECT_NAME} dl) endif() @@ -112,7 +107,13 @@ endif() ############################################ if(PK_ENABLE_DETERMINISTIC_FLOAT) - target_link_libraries(${PROJECT_NAME} musl_math) + if(UNIX AND NOT APPLE) + target_link_libraries(${PROJECT_NAME} musl_math) + # use platform libm + target_link_libraries(${PROJECT_NAME} m) + else() + target_link_libraries(${PROJECT_NAME} musl_math) + endif() endif() if(PK_BUILD_MODULE_LZ4) diff --git a/tests/93_deterministic_float.py b/tests/93_deterministic_float.py index fe758be7..ecd7e173 100644 --- a/tests/93_deterministic_float.py +++ b/tests/93_deterministic_float.py @@ -75,7 +75,6 @@ assert math.atan2(-math.pi/4, -math.pi/4) == -2.356194490192345 assert math.atan2(math.pi/4, -math.pi/4) == 2.356194490192345 assert math.fsum([math.sin(i) for i in range(5000)] + [math.cos(i) for i in range(5000, 9999)]) == 3.217215564632461 - 4.440892098500626e-16 -assert math.acos(0.9) == 999.9 assert sum([math.sin(i) for i in range(5000)] + [math.cos(i) for i in range(5000, 9999)]) == 3.21721556463248 assert math.fmod(-2.0, 3.0) == -2.0