|
| 1 | +/* origin: FreeBSD /usr/src/lib/msun/src/e_atan2.c */ |
| 2 | +/* |
| 3 | + * ==================================================== |
| 4 | + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
| 5 | + * |
| 6 | + * Developed at SunSoft, a Sun Microsystems, Inc. business. |
| 7 | + * Permission to use, copy, modify, and distribute this |
| 8 | + * software is freely granted, provided that this notice |
| 9 | + * is preserved. |
| 10 | + * ==================================================== |
| 11 | + * |
| 12 | + */ |
| 13 | +/* atan2(y,x) |
| 14 | + * Method : |
| 15 | + * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). |
| 16 | + * 2. Reduce x to positive by (if x and y are unexceptional): |
| 17 | + * ARG (x+iy) = arctan(y/x) ... if x > 0, |
| 18 | + * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, |
| 19 | + * |
| 20 | + * Special cases: |
| 21 | + * |
| 22 | + * ATAN2((anything), NaN ) is NaN; |
| 23 | + * ATAN2(NAN , (anything) ) is NaN; |
| 24 | + * ATAN2(+-0, +(anything but NaN)) is +-0 ; |
| 25 | + * ATAN2(+-0, -(anything but NaN)) is +-pi ; |
| 26 | + * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; |
| 27 | + * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; |
| 28 | + * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; |
| 29 | + * ATAN2(+-INF,+INF ) is +-pi/4 ; |
| 30 | + * ATAN2(+-INF,-INF ) is +-3pi/4; |
| 31 | + * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; |
| 32 | + * |
| 33 | + * Constants: |
| 34 | + * The hexadecimal values are the intended ones for the following |
| 35 | + * constants. The decimal values may be used, provided that the |
| 36 | + * compiler will convert from decimal to binary accurately enough |
| 37 | + * to produce the hexadecimal values shown. |
| 38 | + */ |
| 39 | + |
1 | 40 | use super::atan; |
2 | 41 | use super::fabs; |
3 | 42 |
|
|
0 commit comments