diff options
author | das <das@FreeBSD.org> | 2013-06-05 05:33:01 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2013-06-05 05:33:01 +0000 |
commit | 16f58a23858b9b290bd20b39bf643e8b0869e184 (patch) | |
tree | f22b4fedcc606eb0b7ccbd4ae8136df87d126c3a /lib/msun/src/catrig.c | |
parent | f228730cd01207092a30e3c540b85818990759fa (diff) | |
download | FreeBSD-src-16f58a23858b9b290bd20b39bf643e8b0869e184.zip FreeBSD-src-16f58a23858b9b290bd20b39bf643e8b0869e184.tar.gz |
Style fixes.
Submitted by: bde
Diffstat (limited to 'lib/msun/src/catrig.c')
-rw-r--r-- | lib/msun/src/catrig.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/lib/msun/src/catrig.c b/lib/msun/src/catrig.c index f69a337..200977c 100644 --- a/lib/msun/src/catrig.c +++ b/lib/msun/src/catrig.c @@ -151,13 +151,13 @@ f(double a, double b, double hypot_a_b) */ static inline void do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B, - double *sqrt_A2my2, double *new_y) + double *sqrt_A2my2, double *new_y) { double R, S, A; /* A, B, R, and S are as in Hull et al. */ double Am1, Amy; /* A-1, A-y. */ - R = hypot(x, y + 1); /* |z+I| */ - S = hypot(x, y - 1); /* |z-I| */ + R = hypot(x, y + 1); /* |z+I| */ + S = hypot(x, y - 1); /* |z-I| */ /* A = (|z+I| + |z-I|) / 2 */ A = (R + S) / 2; @@ -174,7 +174,7 @@ do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B, * Am1 = fp + fm, where fp = f(x, 1+y), and fm = f(x, 1-y). * rx = log1p(Am1 + sqrt(Am1*(A+1))) */ - if (y == 1 && x < DBL_EPSILON*DBL_EPSILON / 128) { + if (y == 1 && x < DBL_EPSILON * DBL_EPSILON / 128) { /* * fp is of order x^2, and fm = x/2. * A = 1 (inexactly). @@ -193,7 +193,7 @@ do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B, * A = 1 (inexactly). */ *rx = x / sqrt((1 - y) * (1 + y)); - } else /* if (y > 1) */ { + } else { /* if (y > 1) */ /* * A-1 = y-1 (inexactly). */ @@ -251,9 +251,9 @@ do_hard_work(double x, double y, double *rx, int *B_is_usable, double *B, * scaling should avoid any underflow problems. */ *sqrt_A2my2 = x * (4 / DBL_EPSILON / DBL_EPSILON) * y / - sqrt((y + 1) * (y - 1)); + sqrt((y + 1) * (y - 1)); *new_y = y * (4 / DBL_EPSILON / DBL_EPSILON); - } else /* if (y < 1) */ { + } else { /* if (y < 1) */ /* * fm = 1-y >= DBL_EPSILON, fp is of order x^2, and * A = 1 (inexactly). @@ -298,7 +298,6 @@ casinh(double complex z) * C99 leaves it optional whether to raise invalid if one of * the arguments is not NaN, so we opt not to raise it. */ - /* Bruce Evans tells me this is the way to do this: */ return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); } @@ -337,6 +336,7 @@ double complex casin(double complex z) { double complex w = casinh(cpack(cimag(z), creal(z))); + return (cpack(cimag(w), creal(w))); } @@ -402,17 +402,17 @@ cacos(double complex z) /* All remaining cases are inexact. */ raise_inexact(); - if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON/4) + if (ax < SQRT_6_EPSILON / 4 && ay < SQRT_6_EPSILON / 4) return (cpack(pio2_hi - (x - pio2_lo), -y)); do_hard_work(ay, ax, &ry, &B_is_usable, &B, &sqrt_A2mx2, &new_x); if (B_is_usable) { - if (sx==0) + if (sx == 0) rx = acos(B); else rx = acos(-B); } else { - if (sx==0) + if (sx == 0) rx = atan2(sqrt_A2mx2, new_x); else rx = atan2(sqrt_A2mx2, -new_x); @@ -488,10 +488,6 @@ clog_for_large_values(double complex z) } /* - *============================================================================= - */ - -/* * ================= * | catanh, catan | * ================= @@ -511,6 +507,7 @@ sum_squares(double x, double y) /* Avoid underflow when y is small. */ if (y < SQRT_MIN) return (x * x); + return (x * x + y * y); } @@ -578,7 +575,7 @@ catanh(double complex z) /* This helps handle many cases. */ if (y == 0 && ax <= 1) - return (cpack(atanh(x), y)); + return (cpack(atanh(x), y)); /* To ensure the same accuracy as atan(), and to filter out z = 0. */ if (x == 0) @@ -589,10 +586,9 @@ catanh(double complex z) if (isinf(x)) return (cpack(copysign(0, x), y + y)); /* catanh(NaN + I*+-Inf) = sign(NaN)0 + I*+-PI/2 */ - if (isinf(y)) { + if (isinf(y)) return (cpack(copysign(0, x), - copysign(pio2_hi + pio2_lo, y))); - } + copysign(pio2_hi + pio2_lo, y))); /* * All other cases involving NaN return NaN + I*NaN. * C99 leaves it optional whether to raise invalid if one of @@ -601,10 +597,9 @@ catanh(double complex z) return (cpack(x + 0.0L + (y + 0), x + 0.0L + (y + 0))); } - if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) { + if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) return (cpack(real_part_reciprocal(x, y), - copysign(pio2_hi + pio2_lo, y))); - } + copysign(pio2_hi + pio2_lo, y))); if (ax < SQRT_3_EPSILON / 2 && ay < SQRT_3_EPSILON / 2) { /* @@ -617,7 +612,7 @@ catanh(double complex z) } if (ax == 1 && ay < DBL_EPSILON) - rx = (log(ay) - m_ln2) / -2; + rx = (m_ln2 - log(ay)) / 2; else rx = log1p(4 * ax / sum_squares(ax - 1, ay)) / 4; @@ -639,5 +634,6 @@ double complex catan(double complex z) { double complex w = catanh(cpack(cimag(z), creal(z))); + return (cpack(cimag(w), creal(w))); } |