Deleted Added
full compact
e_sqrt.c (141296) e_sqrt.c (176720)
1
2/* @(#)e_sqrt.c 1.3 95/01/18 */
3/*
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 *
7 * Developed at SunSoft, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
10 * is preserved.
11 * ====================================================
12 */
13
1
2/* @(#)e_sqrt.c 1.3 95/01/18 */
3/*
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 *
7 * Developed at SunSoft, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
10 * is preserved.
11 * ====================================================
12 */
13
14#ifndef lint
15static char rcsid[] = "$FreeBSD: head/lib/msun/src/e_sqrt.c 141296 2005-02-04 18:26:06Z das $";
16#endif
14#include <sys/cdefs.h>
15__FBSDID("$FreeBSD: head/lib/msun/src/e_sqrt.c 176720 2008-03-02 01:47:58Z das $");
17
18/* __ieee754_sqrt(x)
19 * Return correctly rounded sqrt.
20 * ------------------------------------------
21 * | Use the hardware sqrt if you have one |
22 * ------------------------------------------
23 * Method:
24 * Bit by bit method using integer arithmetic. (Slow, but portable)

--- 55 unchanged lines hidden (view full) ---

80 * sqrt(inf) = inf
81 * sqrt(-ve) = NaN ... with invalid signal
82 * sqrt(NaN) = NaN ... with invalid signal for signaling NaN
83 *
84 * Other methods : see the appended file at the end of the program below.
85 *---------------
86 */
87
16
17/* __ieee754_sqrt(x)
18 * Return correctly rounded sqrt.
19 * ------------------------------------------
20 * | Use the hardware sqrt if you have one |
21 * ------------------------------------------
22 * Method:
23 * Bit by bit method using integer arithmetic. (Slow, but portable)

--- 55 unchanged lines hidden (view full) ---

79 * sqrt(inf) = inf
80 * sqrt(-ve) = NaN ... with invalid signal
81 * sqrt(NaN) = NaN ... with invalid signal for signaling NaN
82 *
83 * Other methods : see the appended file at the end of the program below.
84 *---------------
85 */
86
87#include <float.h>
88
88#include "math.h"
89#include "math_private.h"
90
91static const double one = 1.0, tiny=1.0e-300;
92
93double
94__ieee754_sqrt(double x)
95{

--- 86 unchanged lines hidden (view full) ---

182 ix0 = (q>>1)+0x3fe00000;
183 ix1 = q1>>1;
184 if ((q&1)==1) ix1 |= sign;
185 ix0 += (m <<20);
186 INSERT_WORDS(z,ix0,ix1);
187 return z;
188}
189
89#include "math.h"
90#include "math_private.h"
91
92static const double one = 1.0, tiny=1.0e-300;
93
94double
95__ieee754_sqrt(double x)
96{

--- 86 unchanged lines hidden (view full) ---

183 ix0 = (q>>1)+0x3fe00000;
184 ix1 = q1>>1;
185 if ((q&1)==1) ix1 |= sign;
186 ix0 += (m <<20);
187 INSERT_WORDS(z,ix0,ix1);
188 return z;
189}
190
191#if (LDBL_MANT_DIG == 53)
192__weak_reference(sqrt, sqrtl);
193#endif
194
190/*
191Other methods (use floating-point arithmetic)
192-------------
193(This is a copy of a drafted paper by Prof W. Kahan
194and K.C. Ng, written in May, 1986)
195
196 Two algorithms are given here to implement sqrt(x)
197 (IEEE double precision arithmetic) in software.

--- 249 unchanged lines hidden ---
195/*
196Other methods (use floating-point arithmetic)
197-------------
198(This is a copy of a drafted paper by Prof W. Kahan
199and K.C. Ng, written in May, 1986)
200
201 Two algorithms are given here to implement sqrt(x)
202 (IEEE double precision arithmetic) in software.

--- 249 unchanged lines hidden ---