From 45ab0165ccb83927281978a447898b554929fc51 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 1 Apr 2012 19:29:21 +0200 Subject: [PATCH] log10l: Work around log10l-ieee test failure on IRIX 6.5. * lib/log10l.c: Include (log10l): On IRIX, normalize the +Infinity value. * modules/log10l (Depends-on): Add 'float'. * doc/posix-functions/log10l.texi: Mention the IRIX problem with +Infinity. --- ChangeLog | 7 +++++++ doc/posix-functions/log10l.texi | 3 +++ lib/log10l.c | 12 +++++++++++- modules/log10l | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 432d422fe..3d8f7a308 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2012-04-01 Bruno Haible + log10l: Work around log10l-ieee test failure on IRIX 6.5. + * lib/log10l.c: Include + (log10l): On IRIX, normalize the +Infinity value. + * modules/log10l (Depends-on): Add 'float'. + * doc/posix-functions/log10l.texi: Mention the IRIX problem with + +Infinity. + log10f-ieee: Work around test failure on NetBSD 5.1. * m4/log10f-ieee.m4: New file. * m4/log10f.m4 (gl_FUNC_LOG10F): If gl_FUNC_LOG10F_IEEE is present, diff --git a/doc/posix-functions/log10l.texi b/doc/posix-functions/log10l.texi index eb8eec8cd..82841c600 100644 --- a/doc/posix-functions/log10l.texi +++ b/doc/posix-functions/log10l.texi @@ -23,6 +23,9 @@ OSF/1 5.1. @item This function returns an unnormalized negative infinity for a minus zero argument on some platforms: IRIX 6.5. +@item +This function returns an unnormalized positive infinity for a positive infinite argument on some platforms: +IRIX 6.5. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/log10l.c b/lib/log10l.c index f10853890..eb83a1159 100644 --- a/lib/log10l.c +++ b/lib/log10l.c @@ -29,6 +29,8 @@ log10l (long double x) #elif HAVE_LOG10L +# include + long double log10l (long double x) # undef log10l @@ -37,7 +39,15 @@ log10l (long double x) if (x == 0.0L) /* Return -Infinity. */ return -1.0L / 0.0L; - return log10l (x); + { + long double y = log10l (x); +# ifdef __sgi + /* Normalize the +Infinity value. */ + if (y > LDBL_MAX) + y = 1.0L / 0.0L; +# endif + return y; + } } #else diff --git a/modules/log10l b/modules/log10l index cad6bbeed..32aa95919 100644 --- a/modules/log10l +++ b/modules/log10l @@ -9,6 +9,7 @@ Depends-on: math extensions log10 [{ test $HAVE_LOG10L = 0 || test $REPLACE_LOG10L = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1] +float [{ test $HAVE_LOG10L = 0 || test $REPLACE_LOG10L = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] logl [{ test $HAVE_LOG10L = 0 || test $REPLACE_LOG10L = 1; } && test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 0] configure.ac: -- 2.11.0