diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2006-01-10 16:51:58 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2006-01-10 16:51:58 +0000 |
commit | 216633f73cd9c8163b2b2fe5f6c00e8d819ade1f (patch) | |
tree | 8eff42c360f88c77599663165875c3ee89353692 | |
parent | 23de77b72babc03ab1d8a3283ccfb8cf0c042a1c (diff) | |
download | newlib-216633f73cd9c8163b2b2fe5f6c00e8d819ade1f.zip newlib-216633f73cd9c8163b2b2fe5f6c00e8d819ade1f.tar.gz newlib-216633f73cd9c8163b2b2fe5f6c00e8d819ade1f.tar.bz2 |
2006-01-10 Jeff Johnston <jjohnstn@redhat.com>
* libm/mathfp/s_frexp.c: Check for special values on
the original input, not the manipulated output value.
* libm/mathfp/sf_frexp.c: Ditto.
* libm/mathfp/s_atangent.c: Don't use local value branch
when checking for quadrant.
* libm/mathfp/sf_atangent.c: Ditto.
-rw-r--r-- | newlib/ChangeLog | 9 | ||||
-rw-r--r-- | newlib/libm/mathfp/s_atangent.c | 4 | ||||
-rw-r--r-- | newlib/libm/mathfp/s_frexp.c | 21 | ||||
-rw-r--r-- | newlib/libm/mathfp/sf_atangent.c | 4 | ||||
-rw-r--r-- | newlib/libm/mathfp/sf_frexp.c | 21 |
5 files changed, 35 insertions, 24 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 779efd6..8e18f7f 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,12 @@ +2006-01-10 Jeff Johnston <jjohnstn@redhat.com> + + * libm/mathfp/s_frexp.c: Check for special values on + the original input, not the manipulated output value. + * libm/mathfp/sf_frexp.c: Ditto. + * libm/mathfp/s_atangent.c: Don't use local value branch + when checking for quadrant. + * libm/mathfp/sf_atangent.c: Ditto. + 2006-01-09 Jeff Johnston <jjohnstn@redhat.com> * libc/stdio/freopen.c: Switch to use isatty instead of _isatty. diff --git a/newlib/libm/mathfp/s_atangent.c b/newlib/libm/mathfp/s_atangent.c index 981e1c8..0a7c4d2 100644 --- a/newlib/libm/mathfp/s_atangent.c +++ b/newlib/libm/mathfp/s_atangent.c @@ -197,9 +197,9 @@ _DEFUN (atangent, (double, double, double, int), if (arctan2) { - if (u < 0.0 || branch == 2) + if (u < 0.0) res = __PI - res; - if (v < 0.0 || branch == 1) + if (v < 0.0) res = -res; } else if (x < 0.0) diff --git a/newlib/libm/mathfp/s_frexp.c b/newlib/libm/mathfp/s_frexp.c index 08611e9..54fa336 100644 --- a/newlib/libm/mathfp/s_frexp.c +++ b/newlib/libm/mathfp/s_frexp.c @@ -82,6 +82,17 @@ double frexp (double d, int *exp) double f; __uint32_t hd, ld, hf, lf; + /* Check for special values. */ + switch (numtest (d)) + { + case NAN: + case INF: + errno = EDOM; + case 0: + *exp = 0; + return (d); + } + EXTRACT_WORDS (hd, ld, d); /* Get the exponent. */ @@ -94,16 +105,6 @@ double frexp (double d, int *exp) INSERT_WORDS (f, hf, lf); - /* Check for special values. */ - switch (numtest (f)) - { - case NAN: - case INF: - errno = EDOM; - *exp = 0; - return (f); - } - return (f); } diff --git a/newlib/libm/mathfp/sf_atangent.c b/newlib/libm/mathfp/sf_atangent.c index 55a9006..7a8f0ce 100644 --- a/newlib/libm/mathfp/sf_atangent.c +++ b/newlib/libm/mathfp/sf_atangent.c @@ -126,9 +126,9 @@ _DEFUN (atangentf, (float, float, float, int), if (arctan2) { - if (u < 0.0 || branch == 2) + if (u < 0.0) res = __PI - res; - if (v < 0.0 || branch == 1) + if (v < 0.0) res = -res; } else if (x < 0.0) diff --git a/newlib/libm/mathfp/sf_frexp.c b/newlib/libm/mathfp/sf_frexp.c index c2751f6..7f25195 100644 --- a/newlib/libm/mathfp/sf_frexp.c +++ b/newlib/libm/mathfp/sf_frexp.c @@ -24,6 +24,17 @@ float frexpf (float d, int *exp) float f; __int32_t wf, wd; + /* Check for special values. */ + switch (numtestf (d)) + { + case NAN: + case INF: + errno = EDOM; + case 0: + *exp = 0; + return (d); + } + GET_FLOAT_WORD (wd, d); /* Get the exponent. */ @@ -35,16 +46,6 @@ float frexpf (float d, int *exp) SET_FLOAT_WORD (f, wf); - /* Check for special values. */ - switch (numtestf (f)) - { - case NAN: - case INF: - errno = EDOM; - *exp = 0; - return (f); - } - return (f); } |