Skip to content
Myr

Enable gamma, drem on macOS

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by itchyny · committed by Nico Williams · parent a1e791a · Browse files · 2 files+11 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+11 added−5 removed

  • other:+11 added−5 removed

2 files+11 added−5 removed

modified:src/builtin.c+9 added-3 removed
105 unmodified lines
106107#ifdef __APPLE__108// macOS has a bunch of libm deprecation warnings, so let's clean those up109#ifdef HAVE_TGAMMA110#define HAVE_GAMMA111#define gamma tgamma112#endif113#ifdef HAVE___EXP10114#define HAVE_EXP10115#define exp10 __exp10116#endif117#ifdef HAVE_REMAINDER118#define HAVE_DREM119#define drem remainder120#endif121122// We replace significand with our own, since there's not a rename-replacement123#ifdef HAVE_FREXP121#define HAVE_CUSTOM_SIGNIFICAND124static double __jq_significand(double x) {125 int z;126 return 2*frexp(x, &z);127}128#define HAVE_SIGNIFICAND129#define significand __jq_significand130#elif defined(HAVE_SCALBN) && defined(HAVE_ILOGB)128#define HAVE_CUSTOM_SIGNIFICAND131static double __jq_significand(double x) {132 return scalbn(x, -ilogb(x));133}134#define HAVE_SIGNIFICAND135#define significand __jq_significand136#endif137138#endif // ifdef __APPLE__
1739 unmodified lines
1878#undef LIBM_DDD1879#undef LIBM_DD18801881#ifdef __APPLE__1879#undef HAVE_CUSTOM_SIGNIFICAND1882#undef HAVE_GAMMA1883#undef HAVE_EXP101884#undef HAVE_DREM1885#undef HAVE_SIGNIFICAND1886#endif18871888static block gen_builtin_list(block builtins) {1889 jv list = jv_array_append(block_list_funcs(builtins, 1), jv_string("builtins/0"));
17 unmodified lines
modified:src/libm.h+2 added-2 removed
172 unmodified lines
173LIBM_DD(erfc)174#else175LIBM_DD_NO(erfc)176#endif177#if (defined(HAVE_EXP10) && !defined(WIN32)) || (defined(__APPLE__) && defined(HAVE___EXP10))177#if defined(HAVE_EXP10) && !defined(WIN32)178LIBM_DD(exp10)179#else180LIBM_DD_NO(exp10)181#endif
91 unmodified lines
273LIBM_DDD(scalbln)274#else275LIBM_DDD_NO(scalbln)276#endif277#if defined(HAVE_CUSTOM_SIGNIFICAND) || (defined(HAVE_SIGNIFICAND) && !defined(WIN32))277#if defined(HAVE_SIGNIFICAND) && !defined(WIN32)278LIBM_DD(significand)279#else280LIBM_DD_NO(significand)281#endif
10 unmodified lines