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 #if defined(ELFOBJ)
31 #pragma weak hypotl = __hypotl
32 #endif
33
34 /*
35 * hypotl(x,y)
36 * Method :
37 * If z=x*x+y*y has error less than sqrt(2)/2 ulp than sqrt(z) has
38 * error less than 1 ulp.
39 * So, compute sqrt(x*x+y*y) with some care as follows:
40 * Assume x>y>0;
41 * 1. save and set rounding to round-to-nearest
42 * 2. if x > 2y use
43 * x1*x1+(y*y+(x2*(x+x2))) for x*x+y*y
44 * where x1 = x with lower 32 bits cleared, x2 = x-x1; else
45 * 3. if x <= 2y use
46 * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y))
47 * where t1 = 2x with lower 64 bits cleared, t2 = 2x-t1, y1= y with
48 * lower 32 bits cleared, y2 = y-y1.
49 *
50 * NOTE: DO NOT remove parenthsis!
51 *
52 * Special cases:
|
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 hypotl = __hypotl
31
32 /*
33 * hypotl(x,y)
34 * Method :
35 * If z=x*x+y*y has error less than sqrt(2)/2 ulp than sqrt(z) has
36 * error less than 1 ulp.
37 * So, compute sqrt(x*x+y*y) with some care as follows:
38 * Assume x>y>0;
39 * 1. save and set rounding to round-to-nearest
40 * 2. if x > 2y use
41 * x1*x1+(y*y+(x2*(x+x2))) for x*x+y*y
42 * where x1 = x with lower 32 bits cleared, x2 = x-x1; else
43 * 3. if x <= 2y use
44 * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y))
45 * where t1 = 2x with lower 64 bits cleared, t2 = 2x-t1, y1= y with
46 * lower 32 bits cleared, y2 = y-y1.
47 *
48 * NOTE: DO NOT remove parenthsis!
49 *
50 * Special cases:
|