X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Flogf.c;h=ffa2f0843426b626bf95680caa6c061fd748ebba;hb=43593319b31e6b0175b8eec4433bac744959822d;hp=684e9f31d6a4925682c11dd15de3bc3b82e53065;hpb=54a8ff340a865f5409072565e5b199c4451ea60e;p=gnulib.git diff --git a/lib/logf.c b/lib/logf.c index 684e9f31d..ffa2f0843 100644 --- a/lib/logf.c +++ b/lib/logf.c @@ -1,5 +1,5 @@ /* Natural 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 logf (float x) +#undef logf { +#if HAVE_LOGF + 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 logf (x); +#else return (float) log ((double) x); +#endif }