diff options
author | das <das@FreeBSD.org> | 2008-01-11 04:18:25 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2008-01-11 04:18:25 +0000 |
commit | c7fe2c294acd6b2c41ab00906f9ec475a0e9d4dc (patch) | |
tree | 933ea958d0e1f6d2264536d072ac65cb21ea4abf /lib/msun/src/s_csqrtf.c | |
parent | bc3858933dfca9403c35f6cc517a84f827e69f17 (diff) | |
download | FreeBSD-src-c7fe2c294acd6b2c41ab00906f9ec475a0e9d4dc.zip FreeBSD-src-c7fe2c294acd6b2c41ab00906f9ec475a0e9d4dc.tar.gz |
- Correct the range check in the double version to catch negative values
that would overflow.
- Style fixes and improved handling of NaNs suggested by bde.
Diffstat (limited to 'lib/msun/src/s_csqrtf.c')
-rw-r--r-- | lib/msun/src/s_csqrtf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/msun/src/s_csqrtf.c b/lib/msun/src/s_csqrtf.c index cc5485a..6c70ac1 100644 --- a/lib/msun/src/s_csqrtf.c +++ b/lib/msun/src/s_csqrtf.c @@ -54,13 +54,13 @@ csqrtf(float complex z) return (cpackf(INFINITY, b)); if (isnan(a)) { t = (b - b) / (b - b); /* raise invalid if b is not a NaN */ - return (cpackf(t, t)); /* return NaN + NaN i */ + return (cpackf(a, t)); /* return NaN + NaN i */ } if (isinf(a)) { /* - * csqrtf(inf + nan i) = inf + nan i + * csqrtf(inf + NaN i) = inf + NaN i * csqrtf(inf + y i) = inf + 0 i - * csqrtf(-inf + nan i) = nan +- inf i + * csqrtf(-inf + NaN i) = NaN +- inf i * csqrtf(-inf + y i) = 0 + inf i */ if (signbit(a)) |