diff --git a/src/acconfig.h b/src/acconfig.h index 44b55d2b879106c67806161ca7def88acf3cbcde..e2a924e152262214c5387a461142dd6ebd9c33ff 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -307,9 +307,6 @@ /* Define this if you have dlopen */ #undef HAVE_DLOPEN -/* Define if you have ldexp. */ -#undef HAVE_LDEXP - /* Define if you have rint. */ #undef HAVE_RINT diff --git a/src/configure.in b/src/configure.in index 4664c56ccc45d9a105784538c8201725cf15faaf..870aa40edade52ab422b8b7b1d4d2d491ab99ec6 100644 --- a/src/configure.in +++ b/src/configure.in @@ -5684,6 +5684,7 @@ MY_CHECK_FUNCTION(isunordered, int t = isunordered(0.0, 0.0); exit(0); ]) + ######################################################################## MY_CHECK_FUNCTION(dlopen, [ @@ -5692,21 +5693,6 @@ MY_CHECK_FUNCTION(dlopen, dlopen(0, 0); exit(0); ]) -######################################################################## - -MY_CHECK_FUNCTION(ldexp, -[ -#include <math.h> -], [ - double x; - int p; - - for(x=0.0;x<2.0;x+=1.0/64.0) - for(p=-6;p<7;p++) - if(ldexp(x,p) != x*pow(2.0, (double)p)) - exit(1); - exit(0); -]) ######################################################################## MY_CHECK_FUNCTION(rint, diff --git a/src/encode.c b/src/encode.c index 4644ea96bd2894af1a01a5ee65f8bd5ca4b0b2ed..09627c65a860e64569c40eae129bb38de9487ca3 100644 --- a/src/encode.c +++ b/src/encode.c @@ -2631,13 +2631,13 @@ static void decode_value2(struct decode_data *data) break; default: - push_float(DO_NOT_WARN((FLOAT_TYPE)LDEXP(res, num))); + push_float(DO_NOT_WARN((FLOAT_TYPE)ldexp(res, num))); break; } break; } - push_float(DO_NOT_WARN((FLOAT_TYPE)LDEXP(res, num))); + push_float(DO_NOT_WARN((FLOAT_TYPE)ldexp(res, num))); break; } diff --git a/src/port.c b/src/port.c index 20ef64351ac4e88bffbcddfb7304c3a49afb6eae..bc62b35b15cd90eb4344182a85136bdc0bfb1d76 100644 --- a/src/port.c +++ b/src/port.c @@ -597,13 +597,6 @@ long long gethrtime() #endif /* OWN_GETHRTIME */ -#ifndef HAVE_LDEXP -double LDEXP(double x, int exp) -{ - return x * pow(2.0,(double)exp); -} -#endif - #ifdef __MINGW32__ struct errmapping { const int winerr; diff --git a/src/port.h b/src/port.h index 1f25bf32b27b65514d00f4c4f9296daf9fc58e3e..ec839a46157931de2f53a99216ce37edb552e3dc 100644 --- a/src/port.h +++ b/src/port.h @@ -366,11 +366,8 @@ long long gethrtime(void); #define HAVE_FREXP 1 #define FREXP frexp -#ifdef HAVE_LDEXP +#define HAVE_LDEXP 1 #define LDEXP ldexp -#else -double LDEXP(double x, int exp); -#endif #ifdef __MINGW32__ #ifndef HAVE__DOSMAPERR diff --git a/src/sprintf.c b/src/sprintf.c index 16e2b949565ae1c8cb04147df5df0b4cb9a4c5da..2638053c83f253833dbfee29068162750358192a 100644 --- a/src/sprintf.c +++ b/src/sprintf.c @@ -505,7 +505,7 @@ static void low_write_IEEE_float(char *b, double d, int sz) e += 126; d *= 16777216.0; if(e<=0) { - d = LDEXP(d, e-1); + d = ldexp(d, e-1); e = 0; } f = ((INT32)floor(d))&maxf; @@ -514,7 +514,7 @@ static void low_write_IEEE_float(char *b, double d, int sz) e += 1022; d *= 2097152.0; if(e<=0) { - d = LDEXP(d, e-1); + d = ldexp(d, e-1); e = 0; } d2 = floor(d); diff --git a/src/sscanf.c b/src/sscanf.c index e548106e09a74df88d7a412c0fb0255f79e336ae..740523dd65658dc66e0c58b0efdd63ca8148ac94 100644 --- a/src/sscanf.c +++ b/src/sscanf.c @@ -460,7 +460,7 @@ static INLINE FLOAT_TYPE low_parse_IEEE_float(char *b, int sz) r = (double)f; if(extra_f) r += ((double)extra_f)/4294967296.0; - return (FLOAT_TYPE)(s? -LDEXP(r, e):LDEXP(r, e)); + return (FLOAT_TYPE)(s? -ldexp(r, e):ldexp(r, e)); } #endif