diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | lib/ldexpl.c | 16 | ||||
-rw-r--r-- | m4/ldexpl.m4 | 10 | ||||
-rw-r--r-- | modules/ldexpl | 5 |
4 files changed, 34 insertions, 6 deletions
@@ -1,3 +1,12 @@ +2011-10-10 Bruno Haible <bruno@clisp.org> + + ldexpl: Simplify for platforms where 'long double' == 'double'. + * lib/ldexpl.c (ldexpl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New + alternative implementation. + * m4/ldexpl.m4 (gl_FUNC_LDEXPL): Require gl_LONG_DOUBLE_VS_DOUBLE. + Determine LDEXPL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. + * modules/ldexpl (Depends-on): Add ldexp. Update conditions. + 2011-10-10 Tom G. Christensen <tgc@jupiterrise.com> (tiny change) ffsll: set correct witness diff --git a/lib/ldexpl.c b/lib/ldexpl.c index 4389f761b2..7fb3a7dd54 100644 --- a/lib/ldexpl.c +++ b/lib/ldexpl.c @@ -23,8 +23,18 @@ /* Specification. */ #include <math.h> -#include <float.h> -#include "fpucw.h" +#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE + +long double +ldexpl (long double x, int exp) +{ + return ldexp (x, exp); +} + +#else + +# include <float.h> +# include "fpucw.h" long double ldexpl (long double x, int exp) @@ -65,6 +75,8 @@ ldexpl (long double x, int exp) return x; } +#endif + #if 0 int main (void) diff --git a/m4/ldexpl.m4 b/m4/ldexpl.m4 index 4e419cf205..f5d15fd672 100644 --- a/m4/ldexpl.m4 +++ b/m4/ldexpl.m4 @@ -1,4 +1,4 @@ -# ldexpl.m4 serial 13 +# ldexpl.m4 serial 14 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_LDEXPL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) AC_REQUIRE([gl_FUNC_ISNANL]) dnl for ISNANL_LIBM dnl Check whether it's declared. dnl MacOS X 10.3 has ldexpl() in libc but doesn't declare it in <math.h>. @@ -53,7 +54,12 @@ AC_DEFUN([gl_FUNC_LDEXPL], fi if test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; then dnl Find libraries needed to link lib/ldexpl.c. - LDEXPL_LIBM="$ISNANL_LIBM" + if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then + AC_REQUIRE([gl_FUNC_LDEXP]) + LDEXPL_LIBM="$LDEXP_LIBM" + else + LDEXPL_LIBM="$ISNANL_LIBM" + fi fi AC_SUBST([LDEXPL_LIBM]) ]) diff --git a/modules/ldexpl b/modules/ldexpl index b6d3117343..35e52ab0ce 100644 --- a/modules/ldexpl +++ b/modules/ldexpl @@ -7,8 +7,9 @@ m4/ldexpl.m4 Depends-on: math -isnanl [test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no] -fpucw [test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no] +ldexp [{ test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1] +isnanl [{ test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] +fpucw [{ test $HAVE_DECL_LDEXPL = 0 || test $gl_func_ldexpl = no; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] configure.ac: gl_FUNC_LDEXPL |