]> Savannah Git Hosting - gnulib.git/commitdiff
ldexpl: Simplify for platforms where 'long double' == 'double'.
authorBruno Haible <bruno@clisp.org>
Mon, 10 Oct 2011 21:35:54 +0000 (23:35 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 10 Oct 2011 21:35:54 +0000 (23:35 +0200)
* 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.

ChangeLog
lib/ldexpl.c
m4/ldexpl.m4
modules/ldexpl

index 0c7506f1646f3ac7e0cc18e5fee627c5377c15a5..5a12fa94827fcf9efa936450cf0f4a4db55ae601 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 4389f761b2442169d409ccb04bfee067fa4e4e47..7fb3a7dd5474617a8ee5959b12e1b24d9bbc90d7 100644 (file)
 /* 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)
index 4e419cf2058d1542f10900ed7ca8a49589635286..f5d15fd672482a3654a8c48575b20cabf39b9de4 100644 (file)
@@ -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])
 ])
index b6d31173432611c02ac0f59817f35eea6087ca1a..35e52ab0cedb7cd4f78ea4852ee5baba32c62fd4 100644 (file)
@@ -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