Raymond Toy pushed to branch master at cmucl / cmucl Commits: 4775ebfb by Raymond Toy at 2026-03-12T07:31:26-07:00 Fix #486: Rename openlibm functions to be different from libm - - - - - 6b134354 by Raymond Toy at 2026-03-12T07:31:26-07:00 Merge branch 'issue-486-rename-openlibm-functions' into 'master' Fix #486: Rename openlibm functions to be different from libm Closes #486 See merge request cmucl/cmucl!363 - - - - - 11 changed files: - src/lisp/irrat.c - src/lisp/openlibm/math_private.h - src/lisp/openlibm/s_asinhf.c - src/lisp/openlibm/s_atanf.c - src/lisp/openlibm/s_cosf.c - src/lisp/openlibm/s_expm1f.c - src/lisp/openlibm/s_log1pf.c - src/lisp/openlibm/s_sincosf.c - src/lisp/openlibm/s_sinf.c - src/lisp/openlibm/s_tanf.c - src/lisp/openlibm/s_tanhf.c Changes: ===================================== src/lisp/irrat.c ===================================== @@ -56,6 +56,31 @@ extern float cr_expm1f(float); extern void cr_sincosf(float, float *, float *); #else #include "openlibm_math.h" +/* + * Declare the openlibm functions we use. This is needed because we + * changed the names of the openlibm functions. + */ +extern float openlibm_asinhf(float); +extern float openlibm_atanf(float); +extern float openlibm_cosf(float); +extern float openlibm_expm1f(float); +extern float openlibm_log1pf(float); +extern float openlibm_sinf(float); +extern float openlibm_tanf(float); +extern float openlibm_tanhf(float); +extern void openlibm_sincosf(float, float*, float*); +extern float __ieee754_acosf(float); +extern float __ieee754_acoshf(float); +extern float __ieee754_logf(float); +extern float __ieee754_atanhf(float); +extern float __ieee754_asinf(float); +extern float __ieee754_atan2f(float, float); +extern float __ieee754_expf(float); +extern float __ieee754_coshf(float); +extern float __ieee754_log10f(float); +extern float __ieee754_sinhf(float); +extern float __ieee754_hypotf(float, float); + #endif @@ -350,7 +375,7 @@ lisp_sinf(float x) #ifdef FEATURE_CORE_MATH return cr_sinf(x); #else - return sinf(x); + return openlibm_sinf(x); #endif } @@ -360,7 +385,7 @@ lisp_cosf(float x) #ifdef FEATURE_CORE_MATH return cr_cosf(x); #else - return cosf(x); + return openlibm_cosf(x); #endif } @@ -370,7 +395,7 @@ lisp_tanf(float x) #ifdef FEATURE_CORE_MATH return cr_tanf(x); #else - return tanf(x); + return openlibm_tanf(x); #endif } @@ -380,7 +405,7 @@ lisp_atanf(float x) #ifdef FEATURE_CORE_MATH return cr_atanf(x); #else - return atanf(x); + return openlibm_atanf(x); #endif } @@ -390,7 +415,7 @@ lisp_atan2f(float y, float x) #ifdef FEATURE_CORE_MATH return cr_atan2f(y, x); #else - return atan2f(y, x); + return __ieee754_atan2f(y, x); #endif } @@ -400,7 +425,7 @@ lisp_asinf(float x) #ifdef FEATURE_CORE_MATH return cr_asinf(x); #else - return asinf(x); + return __ieee754_asinf(x); #endif } @@ -410,7 +435,7 @@ lisp_acosf(float x) #ifdef FEATURE_CORE_MATH return cr_acosf(x); #else - return acosf(x); + return __ieee754_acosf(x); #endif } @@ -420,7 +445,7 @@ lisp_sinhf(float x) #ifdef FEATURE_CORE_MATH return cr_sinhf(x); #else - return sinhf(x); + return __ieee754_sinhf(x); #endif } @@ -430,7 +455,7 @@ lisp_coshf(float x) #ifdef FEATURE_CORE_MATH return cr_coshf(x); #else - return coshf(x); + return __ieee754_coshf(x); #endif } @@ -440,7 +465,7 @@ lisp_tanhf(float x) #ifdef FEATURE_CORE_MATH return cr_tanhf(x); #else - return tanhf(x); + return openlibm_tanhf(x); #endif } @@ -450,7 +475,7 @@ lisp_asinhf(float x) #ifdef FEATURE_CORE_MATH return cr_asinhf(x); #else - return asinhf((double) x); + return openlibm_asinhf((double) x); #endif } @@ -460,7 +485,7 @@ lisp_acoshf(float x) #ifdef FEATURE_CORE_MATH return cr_acoshf(x); #else - return acoshf(x); + return __ieee754_acoshf(x); #endif } @@ -470,7 +495,7 @@ lisp_atanhf(float x) #ifdef FEATURE_CORE_MATH return cr_atanhf(x); #else - return atanhf(x); + return __ieee754_atanhf(x); #endif } @@ -480,7 +505,7 @@ lisp_expf(float x) #ifdef FEATURE_CORE_MATH return cr_expf(x); #else - return expf(x); + return __ieee754_expf(x); #endif } @@ -490,7 +515,7 @@ lisp_logf(float x) #ifdef FEATURE_CORE_MATH return cr_logf(x); #else - return log(x); + return __ieee754_log(x); #endif } @@ -500,7 +525,7 @@ lisp_log10f(float x) #ifdef FEATURE_CORE_MATH return cr_log10f(x); #else - return log10f(x); + return __ieee754_log10f(x); #endif } @@ -532,7 +557,7 @@ lisp_hypotf(float x, float y) #ifdef FEATURE_CORE_MATH return cr_hypotf(x, y); #else - return hypotf(x, y); + return __ieee754_hypotf(x, y); #endif } @@ -542,7 +567,7 @@ lisp_log1pf(float x) #ifdef FEATURE_CORE_MATH return cr_log1pf(x); #else - return log1pf(x); + return openlibm_log1pf(x); #endif } @@ -552,7 +577,7 @@ lisp_expm1f(float x) #ifdef FEATURE_CORE_MATH return cr_expm1f(x); #else - return expm1f(x); + return openlibm_expm1f(x); #endif } @@ -562,8 +587,8 @@ lisp_sincosf(float x, float *s, float *c) #ifdef FEATURE_CORE_MATH cr_sincosf(x, s, c); #else - extern void sincosf(float x, float *s, float *c); + extern void openlibm_sincosf(float x, float *s, float *c); - sincosf(x, s, c); + openlibm_sincosf(x, s, c); #endif } ===================================== src/lisp/openlibm/math_private.h ===================================== @@ -309,6 +309,7 @@ irint(double x) #define __ieee754_yn yn #define __ieee754_remainder remainder #define __ieee754_sqrtf sqrtf +#if 0 #define __ieee754_acosf acosf #define __ieee754_acoshf acoshf #define __ieee754_logf logf @@ -317,14 +318,31 @@ irint(double x) #define __ieee754_atan2f atan2f #define __ieee754_expf expf #define __ieee754_coshf coshf +#else +extern float __ieee754_acosf(float); +extern float __ieee754_acoshf(float); +extern float __ieee754_logf(float); +extern float __ieee754_atanhf(float); +extern float __ieee754_asinf(float); +extern float __ieee754_atan2f(float, float); +extern float __ieee754_expf(float); +extern float __ieee754_coshf(float); +#endif #define __ieee754_fmodf fmodf #define __ieee754_powf powf #define __ieee754_lgammaf lgammaf #define __ieee754_lgammaf_r lgammaf_r +#if 0 #define __ieee754_log10f log10f #define __ieee754_log2f log2f #define __ieee754_sinhf sinhf #define __ieee754_hypotf hypotf +#else +extern float __ieee754_log10f(float); +extern float __ieee754_log2f(float); +extern float __ieee754_sinhf(float); +extern float __ieee754_hypotf(float, float); +#endif #define __ieee754_j0f j0f #define __ieee754_j1f j1f #define __ieee754_y0f y0f ===================================== src/lisp/openlibm/s_asinhf.c ===================================== @@ -26,7 +26,7 @@ ln2 = 6.9314718246e-01, /* 0x3f317218 */ huge= 1.0000000000e+30; OLM_DLLEXPORT float -asinhf(float x) +openlibm_asinhf(float x) { float t,w; int32_t hx,ix; ===================================== src/lisp/openlibm/s_atanf.c ===================================== @@ -47,7 +47,7 @@ one = 1.0, huge = 1.0e30; OLM_DLLEXPORT float -atanf(float x) +openlibm_atanf(float x) { float w,s1,s2,z; int32_t ix,hx,id; ===================================== src/lisp/openlibm/s_cosf.c ===================================== @@ -36,7 +36,7 @@ c3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */ c4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */ OLM_DLLEXPORT float -cosf(float x) +openlibm_cosf(float x) { double y; int32_t n, hx, ix; ===================================== src/lisp/openlibm/s_expm1f.c ===================================== @@ -38,7 +38,7 @@ Q1 = -3.3333212137e-2, /* -0x888868.0p-28 */ Q2 = 1.5807170421e-3; /* 0xcf3010.0p-33 */ OLM_DLLEXPORT float -expm1f(float x) +openlibm_expm1f(float x) { float y,hi,lo,c,t,e,hxs,hfx,r1,twopk; int32_t k,xsb; ===================================== src/lisp/openlibm/s_log1pf.c ===================================== @@ -36,7 +36,7 @@ Lp7 = 1.4798198640e-01; /* 3E178897 */ static const float zero = 0.0; OLM_DLLEXPORT float -log1pf(float x) +openlibm_log1pf(float x) { float hfsq,f,c,s,z,R,u; int32_t k,hx,hu,ax; ===================================== src/lisp/openlibm/s_sincosf.c ===================================== @@ -73,7 +73,7 @@ __kernel_sincosdf( double x, float * s, float * c ) } OLM_DLLEXPORT void -sincosf(float x, float * s, float * c) { +openlibm_sincosf(float x, float * s, float * c) { // Worst approximation of sin and cos NA *s = x; *c = x; ===================================== src/lisp/openlibm/s_sinf.c ===================================== @@ -36,7 +36,7 @@ s3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */ s4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */ OLM_DLLEXPORT float -sinf(float x) +openlibm_sinf(float x) { double y; int32_t n, hx, ix; ===================================== src/lisp/openlibm/s_tanf.c ===================================== @@ -34,7 +34,7 @@ t3pio2 = 3*M_PI_2, /* 0x4012D97C, 0x7F3321D2 */ t4pio2 = 4*M_PI_2; /* 0x401921FB, 0x54442D18 */ OLM_DLLEXPORT float -tanf(float x) +openlibm_tanf(float x) { double y; int32_t n, hx, ix; ===================================== src/lisp/openlibm/s_tanhf.c ===================================== @@ -22,7 +22,7 @@ static const float one=1.0, two=2.0, tiny = 1.0e-30, huge = 1.0e30; OLM_DLLEXPORT float -tanhf(float x) +openlibm_tanhf(float x) { float t,z; int32_t jx,ix; View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/af26a647c50f74deac23ace... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/af26a647c50f74deac23ace... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)