From: Bruno Haible Date: Tue, 11 Oct 2011 09:15:59 +0000 (+0200) Subject: atanl: Simplify for platforms where 'long double' == 'double'. X-Git-Tag: v0.1~1582 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=2394a603e7586e671226478e5b15d924c3841f42;p=gnulib.git atanl: Simplify for platforms where 'long double' == 'double'. * lib/atanl.c (atanl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New alternative implementation. * m4/atanl.m4 (gl_FUNC_ATANL): Require gl_LONG_DOUBLE_VS_DOUBLE. Determine ATANL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. * modules/atanl (Depends-on): Add atan. Update conditions. --- diff --git a/ChangeLog b/ChangeLog index 01ddd60af..702c1fa13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2011-10-10 Bruno Haible + atanl: Simplify for platforms where 'long double' == 'double'. + * lib/atanl.c (atanl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New + alternative implementation. + * m4/atanl.m4 (gl_FUNC_ATANL): Require gl_LONG_DOUBLE_VS_DOUBLE. + Determine ATANL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. + * modules/atanl (Depends-on): Add atan. Update conditions. + +2011-10-10 Bruno Haible + acosl: Simplify for platforms where 'long double' == 'double'. * lib/acosl.c (acosl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New alternative implementation. diff --git a/lib/atanl.c b/lib/atanl.c index 22a882d4d..4d09c2f20 100644 --- a/lib/atanl.c +++ b/lib/atanl.c @@ -18,6 +18,16 @@ /* Specification. */ #include +#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE + +long double +atanl (long double x) +{ + return atan (x); +} + +#else + /* s_atanl.c * * Inverse circular tangent for 128-bit long double precision @@ -222,3 +232,5 @@ atanl (long double x) else return u; } + +#endif diff --git a/m4/atanl.m4 b/m4/atanl.m4 index 82c9cd409..330ad773f 100644 --- a/m4/atanl.m4 +++ b/m4/atanl.m4 @@ -1,4 +1,4 @@ -# atanl.m4 serial 5 +# atanl.m4 serial 6 dnl Copyright (C) 2010-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,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_ATANL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) + dnl Persuade glibc to declare atanl(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -56,12 +58,17 @@ AC_DEFUN([gl_FUNC_ATANL], HAVE_DECL_ATANL=0 HAVE_ATANL=0 dnl Find libraries needed to link lib/atanl.c. - AC_REQUIRE([gl_FUNC_ISNANL]) - dnl Append $ISNANL_LIBM to ATANL_LIBM, avoiding gratuitous duplicates. - case " $ATANL_LIBM " in - *" $ISNANL_LIBM "*) ;; - *) ATANL_LIBM="$ATANL_LIBM $ISNANL_LIBM" ;; - esac + if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then + AC_REQUIRE([gl_FUNC_ATAN]) + ATANL_LIBM="$ATAN_LIBM" + else + AC_REQUIRE([gl_FUNC_ISNANL]) + dnl Append $ISNANL_LIBM to ATANL_LIBM, avoiding gratuitous duplicates. + case " $ATANL_LIBM " in + *" $ISNANL_LIBM "*) ;; + *) ATANL_LIBM="$ATANL_LIBM $ISNANL_LIBM" ;; + esac + fi fi AC_SUBST([ATANL_LIBM]) ]) diff --git a/modules/atanl b/modules/atanl index 1fd0d9aae..a600846a3 100644 --- a/modules/atanl +++ b/modules/atanl @@ -8,7 +8,8 @@ m4/atanl.m4 Depends-on: math extensions -isnanl [test $HAVE_ATANL = 0] +atan [test $HAVE_ATANL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1] +isnanl [test $HAVE_ATANL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] configure.ac: gl_FUNC_ATANL