10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 */
25 /*
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 #pragma weak hypot = __hypot
31
32 /* INDENT OFF */
33 /*
34 * Hypot(x, y)
35 * by K.C. Ng for SUN 4.0 libm, updated 3/11/2003.
36 * Method :
37 * A. When rounding is rounded-to-nearest:
38 * If z = x * x + y * y has error less than sqrt(2) / 2 ulp than
39 * sqrt(z) has error less than 1 ulp.
40 * So, compute sqrt(x*x+y*y) with some care as follows:
41 * Assume x > y > 0;
42 * 1. Check whether save and set rounding to round-to-nearest
43 * 2. if x > 2y use
44 * xh*xh+(y*y+((x-xh)*(x+xh))) for x*x+y*y
45 * where xh = x with lower 32 bits cleared; else
46 * 3. if x <= 2y use
47 * x2h*yh+((x-y)*(x-y)+(x2h*(y-yh)+(x2-x2h)*y))
48 * where x2 = 2*x, x2h = 2x with lower 32 bits cleared, yh = y with
49 * lower 32 bits chopped.
50 *
|
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 */
25 /*
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 #pragma weak __hypot = hypot
31
32 /* INDENT OFF */
33 /*
34 * Hypot(x, y)
35 * by K.C. Ng for SUN 4.0 libm, updated 3/11/2003.
36 * Method :
37 * A. When rounding is rounded-to-nearest:
38 * If z = x * x + y * y has error less than sqrt(2) / 2 ulp than
39 * sqrt(z) has error less than 1 ulp.
40 * So, compute sqrt(x*x+y*y) with some care as follows:
41 * Assume x > y > 0;
42 * 1. Check whether save and set rounding to round-to-nearest
43 * 2. if x > 2y use
44 * xh*xh+(y*y+((x-xh)*(x+xh))) for x*x+y*y
45 * where xh = x with lower 32 bits cleared; else
46 * 3. if x <= 2y use
47 * x2h*yh+((x-y)*(x-y)+(x2h*(y-yh)+(x2-x2h)*y))
48 * where x2 = 2*x, x2h = 2x with lower 32 bits cleared, yh = y with
49 * lower 32 bits chopped.
50 *
|