X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Flog10f.c;h=4205a473a1c66b6cb53969fd4edf3426339d9121;hb=c50edd6462eaaae00f8549f9bad99d4e68b94376;hp=ad50c535d74695cdf47f212fb6d8b0583f9264eb;hpb=bb09133116a45861827711f5e8faf2c82b98c552;p=gnulib.git diff --git a/lib/log10f.c b/lib/log10f.c index ad50c535d..4205a473a 100644 --- a/lib/log10f.c +++ b/lib/log10f.c @@ -1,5 +1,5 @@ /* Base 10 logarithmic function. - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,22 @@ float log10f (float x) +#undef log10f { +#if HAVE_LOG10F + if (x <= 0.0f) + { + /* Work around the OSF/1 5.1 bug. */ + if (x == 0.0f) + /* Return -Infinity. */ + return -1.0f / 0.0f; + /* Work around the NetBSD 5.1 bug. */ + else /* x < 0.0 */ + /* Return NaN. */ + return 0.0f / 0.0f; + } + return log10f (x); +#else return (float) log10 ((double) x); +#endif }