Mercurial > hg > octave-lyh > gnulib-hg
changeset 15943:617d0805c8d8
acosl: Simplify for platforms where 'long double' == 'double'.
* lib/acosl.c (acosl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New
alternative implementation.
* m4/acosl.m4 (gl_FUNC_ACOSL): Require gl_LONG_DOUBLE_VS_DOUBLE.
Determine ACOSL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE.
* modules/acosl (Depends-on): Add acos. Update conditions.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 11 Oct 2011 11:15:25 +0200 |
parents | cfc88a2774f7 |
children | 4b3d35486c68 |
files | ChangeLog lib/acosl.c m4/acosl.m4 modules/acosl |
diffstat | 4 files changed, 44 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-10-10 Bruno Haible <bruno@clisp.org> + + acosl: Simplify for platforms where 'long double' == 'double'. + * lib/acosl.c (acosl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New + alternative implementation. + * m4/acosl.m4 (gl_FUNC_ACOSL): Require gl_LONG_DOUBLE_VS_DOUBLE. + Determine ACOSL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE. + * modules/acosl (Depends-on): Add acos. Update conditions. + 2011-10-10 Bruno Haible <bruno@clisp.org> asinl: Simplify for platforms where 'long double' == 'double'.
--- a/lib/acosl.c +++ b/lib/acosl.c @@ -14,6 +14,16 @@ /* Specification. */ #include <math.h> +#if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE + +long double +acosl (long double x) +{ + return acos (x); +} + +#else + /* Long double expansions contributed by Stephen L. Moshier <moshier@na-net.ornl.gov> @@ -186,6 +196,8 @@ return 2 * asinl (sqrtl ((1 - x) / 2)); } +#endif + #if 0 int main (void)
--- a/m4/acosl.m4 +++ b/m4/acosl.m4 @@ -1,4 +1,4 @@ -# acosl.m4 serial 5 +# acosl.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_ACOSL], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) + AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) + dnl Persuade glibc <math.h> to declare acosl(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -56,18 +58,23 @@ HAVE_DECL_ACOSL=0 HAVE_ACOSL=0 dnl Find libraries needed to link lib/acosl.c. - AC_REQUIRE([gl_FUNC_ASINL]) - AC_REQUIRE([gl_FUNC_SQRTL]) - dnl Append $ASINL_LIBM to ACOSL_LIBM, avoiding gratuitous duplicates. - case " $ACOSL_LIBM " in - *" $ASINL_LIBM "*) ;; - *) ACOSL_LIBM="$ACOSL_LIBM $ASINL_LIBM" ;; - esac - dnl Append $SQRTL_LIBM to ACOSL_LIBM, avoiding gratuitous duplicates. - case " $ACOSL_LIBM " in - *" $SQRTL_LIBM "*) ;; - *) ACOSL_LIBM="$ACOSL_LIBM $SQRTL_LIBM" ;; - esac + if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then + AC_REQUIRE([gl_FUNC_ACOS]) + ACOSL_LIBM="$ACOS_LIBM" + else + AC_REQUIRE([gl_FUNC_ASINL]) + AC_REQUIRE([gl_FUNC_SQRTL]) + dnl Append $ASINL_LIBM to ACOSL_LIBM, avoiding gratuitous duplicates. + case " $ACOSL_LIBM " in + *" $ASINL_LIBM "*) ;; + *) ACOSL_LIBM="$ACOSL_LIBM $ASINL_LIBM" ;; + esac + dnl Append $SQRTL_LIBM to ACOSL_LIBM, avoiding gratuitous duplicates. + case " $ACOSL_LIBM " in + *" $SQRTL_LIBM "*) ;; + *) ACOSL_LIBM="$ACOSL_LIBM $SQRTL_LIBM" ;; + esac + fi fi AC_SUBST([ACOSL_LIBM]) ])
--- a/modules/acosl +++ b/modules/acosl @@ -8,8 +8,9 @@ Depends-on: math extensions -asinl [test $HAVE_ACOSL = 0] -sqrtl [test $HAVE_ACOSL = 0] +acos [test $HAVE_ACOSL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1] +asinl [test $HAVE_ACOSL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] +sqrtl [test $HAVE_ACOSL = 0 && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] configure.ac: gl_FUNC_ACOSL