2007-10-17 Jeff Johnston <jjohnstn@redhat.com>
* libm/mathfp/s_logarithm.c: Fix error introduced by previous fix when handling negative input values. Make function consistent with math directory and glibc version such that inf and nan values return inf and nan respectively with no errno setting. * libm/mathfp/sf_logarithm.c: Ditto. * libm/math/w_log.c: Set errno to ERANGE when input is 0.0. * libm/math/wf_log.c: Ditto. * libm/math/w_log10.c: Ditto. * libm/math/wf_log10.c: Ditto.
This commit is contained in:
parent
923f9573a3
commit
70317d8506
|
@ -1,3 +1,16 @@
|
|||
2007-10-17 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* libm/mathfp/s_logarithm.c: Fix error introduced by previous
|
||||
fix when handling negative input values. Make function
|
||||
consistent with math directory and glibc version such that
|
||||
inf and nan values return inf and nan respectively with no
|
||||
errno setting.
|
||||
* libm/mathfp/sf_logarithm.c: Ditto.
|
||||
* libm/math/w_log.c: Set errno to ERANGE when input is 0.0.
|
||||
* libm/math/wf_log.c: Ditto.
|
||||
* libm/math/w_log10.c: Ditto.
|
||||
* libm/math/wf_log10.c: Ditto.
|
||||
|
||||
2007-10-17 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* libm/mathfp/s_logarithm.c: Fix case where input is 0 to
|
||||
|
|
|
@ -95,7 +95,7 @@ PORTABILITY
|
|||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = EDOM;
|
||||
errno = ERANGE;
|
||||
}
|
||||
} else {
|
||||
/* log(x<0) */
|
||||
|
|
|
@ -93,7 +93,7 @@ PORTABILITY
|
|||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = EDOM;
|
||||
errno = ERANGE;
|
||||
}
|
||||
} else {
|
||||
/* log10(x<0) */
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = EDOM;
|
||||
errno = ERANGE;
|
||||
}
|
||||
} else {
|
||||
/* logf(x<0) */
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
if (_LIB_VERSION == _POSIX_)
|
||||
errno = ERANGE;
|
||||
else if (!matherr(&exc)) {
|
||||
errno = EDOM;
|
||||
errno = ERANGE;
|
||||
}
|
||||
} else {
|
||||
/* log10f(x<0) */
|
||||
|
|
|
@ -100,12 +100,24 @@ _DEFUN (logarithm, (double, int),
|
|||
int N;
|
||||
double f, w, z;
|
||||
|
||||
/* Check for domain error here. */
|
||||
if (x <= 0.0)
|
||||
/* Check for range and domain errors here. */
|
||||
if (x == 0.0)
|
||||
{
|
||||
errno = ERANGE;
|
||||
return (-z_infinity.d);
|
||||
}
|
||||
else if (x < 0.0)
|
||||
{
|
||||
errno = EDOM;
|
||||
return (z_notanum.d);
|
||||
}
|
||||
else if (!isfinite(x))
|
||||
{
|
||||
if (isnan(x))
|
||||
return (z_notanum.d);
|
||||
else
|
||||
return (z_infinity.d);
|
||||
}
|
||||
|
||||
/* Get the exponent and mantissa where x = f * 2^N. */
|
||||
f = frexp (x, &N);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue