# HG changeset patch # User Bruno Haible # Date 1318324559 -7200 # Node ID 4b3d35486c685cb59cdb4a9aab8f5fa98fc941cd # Parent 617d0805c8d8d41bdd7b725d2252f331373ddc51 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 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +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'. diff --git a/lib/atanl.c b/lib/atanl.c --- 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 @@ else return u; } + +#endif diff --git a/m4/atanl.m4 b/m4/atanl.m4 --- 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 @@ 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 @@ 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 --- a/modules/atanl +++ b/modules/atanl @@ -8,7 +8,8 @@ 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