Lines Matching +full:y +full:-

1 /*-
2 * Copyright (c) 2012 Stephen Montgomery-Smith <stephen@FreeBSD.ORG>
32 * Mathematical Software, Volume 23 Issue 3, 1997, Pages 299-335,
64 FOUR_SQRT_MIN = 0x1p-8189L,
68 SQRT_MIN = 0x1p-8191L;
73 um_ln2 = LD80C(0xb17217f7d1cf79ac, -1, 6.93147180559945309417e-1L);
77 /* The next 2 literals for non-i386. Misrounding them on i386 is harmless. */
78 SQRT_3_EPSILON = 5.70316273435758915310e-10, /* 0x9cc470a0490973e8.0p-94 */
79 SQRT_6_EPSILON = 8.06549008734932771664e-10; /* 0xddb3d742c265539e.0p-94 */
82 m_e = 2.71828182845904523536028747135266250e0L, /* 0x15bf0a8b1457695355fb8ac404e7a.0p-111 */
83 m_ln2 = 6.93147180559945309417232121458176568e-1L, /* 0x162e42fefa39ef35793c7673007e6.0p-113 */
84 SQRT_3_EPSILON = 2.40370335797945490975336727199878124e-17, /* 0x1bb67ae8584caa73b25742d7078b8.0p-
85 SQRT_6_EPSILON = 3.39934988877629587239082586223300391e-17; /* 0x13988e1409212e7d0321914321a55.0p-
91 tiny = 0x1p-100;
99 return ((hypot_a_b - b) / 2); in f()
106 do_hard_work(long double x, long double y, long double *rx, int *B_is_usable, in do_hard_work() argument
112 R = hypotl(x, y + 1); in do_hard_work()
113 S = hypotl(x, y - 1); in do_hard_work()
120 if (y == 1 && x < LDBL_EPSILON * LDBL_EPSILON / 128) { in do_hard_work()
122 } else if (x >= LDBL_EPSILON * fabsl(y - 1)) { in do_hard_work()
123 Am1 = f(x, 1 + y, R) + f(x, 1 - y, S); in do_hard_work()
125 } else if (y < 1) { in do_hard_work()
126 *rx = x / sqrtl((1 - y) * (1 + y)); in do_hard_work()
128 *rx = log1pl((y - 1) + sqrtl((y - 1) * (y + 1))); in do_hard_work()
131 *rx = logl(A + sqrtl(A * A - 1)); in do_hard_work()
134 *new_y = y; in do_hard_work()
136 if (y < FOUR_SQRT_MIN) { in do_hard_work()
139 *new_y = y * (2 / LDBL_EPSILON); in do_hard_work()
143 *B = y / A; in do_hard_work()
148 if (y == 1 && x < LDBL_EPSILON / 128) { in do_hard_work()
149 *sqrt_A2my2 = sqrtl(x) * sqrtl((A + y) / 2); in do_hard_work()
150 } else if (x >= LDBL_EPSILON * fabsl(y - 1)) { in do_hard_work()
151 Amy = f(x, y + 1, R) + f(x, y - 1, S); in do_hard_work()
152 *sqrt_A2my2 = sqrtl(Amy * (A + y)); in do_hard_work()
153 } else if (y > 1) { in do_hard_work()
154 *sqrt_A2my2 = x * (4 / LDBL_EPSILON / LDBL_EPSILON) * y / in do_hard_work()
155 sqrtl((y + 1) * (y - 1)); in do_hard_work()
156 *new_y = y * (4 / LDBL_EPSILON / LDBL_EPSILON); in do_hard_work()
158 *sqrt_A2my2 = sqrtl((1 - y) * (1 + y)); in do_hard_work()
166 long double x, y, ax, ay, rx, ry, B, sqrt_A2my2, new_y; in casinhl() local
171 y = cimagl(z); in casinhl()
173 ay = fabsl(y); in casinhl()
175 if (isnan(x) || isnan(y)) { in casinhl()
177 return (CMPLXL(x, y + y)); in casinhl()
178 if (isinf(y)) in casinhl()
179 return (CMPLXL(y, x + x)); in casinhl()
180 if (y == 0) in casinhl()
181 return (CMPLXL(x + x, y)); in casinhl()
182 return (CMPLXL(nan_mix(x, y), nan_mix(x, y))); in casinhl()
189 w = clog_for_large_values(-z) + m_ln2; in casinhl()
191 copysignl(cimagl(w), y))); in casinhl()
194 if (x == 0 && y == 0) in casinhl()
207 return (CMPLXL(copysignl(rx, x), copysignl(ry, y))); in casinhl()
222 long double x, y, ax, ay, rx, ry, B, sqrt_A2mx2, new_x; in cacosl() local
228 y = cimagl(z); in cacosl()
230 sy = signbit(y); in cacosl()
232 ay = fabsl(y); in cacosl()
234 if (isnan(x) || isnan(y)) { in cacosl()
236 return (CMPLXL(y + y, -INFINITY)); in cacosl()
237 if (isinf(y)) in cacosl()
238 return (CMPLXL(x + x, -y)); in cacosl()
240 return (CMPLXL(pio2_hi + pio2_lo, y + y)); in cacosl()
241 return (CMPLXL(nan_mix(x, y), nan_mix(x, y))); in cacosl()
249 ry = -ry; in cacosl()
253 if (x == 1 && y == 0) in cacosl()
254 return (CMPLXL(0, -y)); in cacosl()
259 return (CMPLXL(pio2_hi - (x - pio2_lo), -y)); in cacosl()
266 rx = acosl(-B); in cacosl()
271 rx = atan2l(sqrt_A2mx2, -new_x); in cacosl()
274 ry = -ry; in cacosl()
299 long double x, y; in clog_for_large_values() local
303 y = cimagl(z); in clog_for_large_values()
305 ay = fabsl(y); in clog_for_large_values()
313 return (CMPLXL(logl(hypotl(x / m_e, y / m_e)) + 1, in clog_for_large_values()
314 atan2l(y, x))); in clog_for_large_values()
317 return (CMPLXL(logl(hypotl(x, y)), atan2l(y, x))); in clog_for_large_values()
319 return (CMPLXL(logl(ax * ax + ay * ay) / 2, atan2l(y, x))); in clog_for_large_values()
323 sum_squares(long double x, long double y) in sum_squares() argument
326 if (y < SQRT_MIN) in sum_squares()
329 return (x * x + y * y); in sum_squares()
333 real_part_reciprocal(long double x, long double y) in real_part_reciprocal() argument
341 GET_LDBL_EXPSIGN(hy, y); in real_part_reciprocal()
343 #define BIAS (LDBL_MAX_EXP - 1) in real_part_reciprocal()
345 if (ix - iy >= CUTOFF || isinf(x)) in real_part_reciprocal()
347 if (iy - ix >= CUTOFF) in real_part_reciprocal()
348 return (x / y / y); in real_part_reciprocal()
349 if (ix <= BIAS + LDBL_MAX_EXP / 2 - CUTOFF) in real_part_reciprocal()
350 return (x / (x * x + y * y)); in real_part_reciprocal()
352 SET_LDBL_EXPSIGN(scale, 0x7fff - ix); in real_part_reciprocal()
354 y *= scale; in real_part_reciprocal()
355 return (x / (x * x + y * y) * scale); in real_part_reciprocal()
361 long double x, y, ax, ay, rx, ry; in catanhl() local
364 y = cimagl(z); in catanhl()
366 ay = fabsl(y); in catanhl()
368 if (y == 0 && ax <= 1) in catanhl()
369 return (CMPLXL(atanhl(x), y)); in catanhl()
372 return (CMPLXL(x, atanl(y))); in catanhl()
374 if (isnan(x) || isnan(y)) { in catanhl()
376 return (CMPLXL(copysignl(0, x), y + y)); in catanhl()
377 if (isinf(y)) in catanhl()
379 copysignl(pio2_hi + pio2_lo, y))); in catanhl()
380 return (CMPLXL(nan_mix(x, y), nan_mix(x, y))); in catanhl()
384 return (CMPLXL(real_part_reciprocal(x, y), in catanhl()
385 copysignl(pio2_hi + pio2_lo, y))); in catanhl()
393 rx = (m_ln2 - logl(ay)) / 2; in catanhl()
395 rx = log1pl(4 * ax / sum_squares(ax - 1, ay)) / 4; in catanhl()
398 ry = atan2l(2, -ay) / 2; in catanhl()
400 ry = atan2l(2 * ay, (1 - ax) * (1 + ax)) / 2; in catanhl()
402 ry = atan2l(2 * ay, (1 - ax) * (1 + ax) - ay * ay) / 2; in catanhl()
404 return (CMPLXL(copysignl(rx, x), copysignl(ry, y))); in catanhl()