Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libm/mathfp/sf_logarithm.c')
-rw-r--r--newlib/libm/mathfp/sf_logarithm.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/newlib/libm/mathfp/sf_logarithm.c b/newlib/libm/mathfp/sf_logarithm.c
index b8564c14c..8aa85e880 100644
--- a/newlib/libm/mathfp/sf_logarithm.c
+++ b/newlib/libm/mathfp/sf_logarithm.c
@@ -38,12 +38,24 @@ _DEFUN (logarithmf, (float, int),
int N;
float f, w, z;
- /* Check for domain error here. */
- if (x <= 0.0)
+ /* Check for domain/range errors here. */
+ if (x == 0.0)
{
errno = ERANGE;
return (-z_infinity_f.f);
}
+ else if (x < 0.0)
+ {
+ errno = EDOM;
+ return (z_notanum_f.f);
+ }
+ else if (!isfinitef(x))
+ {
+ if (isnanf(x))
+ return (z_notanum_f.f);
+ else
+ return (z_infinity_f.f);
+ }
/* Get the exponent and mantissa where x = f * 2^N. */
f = frexpf (x, &N);