Mercurial > hg > octave-shane > gnulib-hg
changeset 15944:4b3d35486c68
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 11 Oct 2011 11:15:59 +0200 |
parents | 617d0805c8d8 |
children | f914ec364e88 |
files | ChangeLog lib/atanl.c m4/atanl.m4 modules/atanl |
diffstat | 4 files changed, 37 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-10-10 Bruno Haible <bruno@clisp.org> + + 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 <bruno@clisp.org> acosl: Simplify for platforms where 'long double' == 'double'.
--- a/lib/atanl.c +++ b/lib/atanl.c @@ -18,6 +18,16 @@ /* Specification. */ #include <math.h> +#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
--- 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 <math.h> 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]) ])