2 /* @(#)w_sqrt.c 5.1 93/09/24 */
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
11 * ====================================================
16 <<sqrt>>, <<sqrtf>>---positive square root
25 double sqrt(double <[x]>);
26 float sqrtf(float <[x]>);
34 <<sqrt>> computes the positive square root of the argument.
35 You can modify error handling for this function with
39 On success, the square root is returned. If <[x]> is real and
40 positive, then the result is positive. If <[x]> is real and
41 negative, the global value <<errno>> is set to <<EDOM>> (domain error).
45 <<sqrt>> is ANSI C. <<sqrtf>> is an extension.
55 #ifndef _DOUBLE_IS_32BITS
58 double sqrt(double x
) /* wrapper sqrt */
60 double sqrt(x
) /* wrapper sqrt */
65 return __ieee754_sqrt(x
);
69 z
= __ieee754_sqrt(x
);
70 if(_LIB_VERSION
== _IEEE_
|| isnan(x
)) return z
;
75 exc
.arg1
= exc
.arg2
= x
;
76 if (_LIB_VERSION
== _SVID_
)
80 if (_LIB_VERSION
== _POSIX_
)
82 else if (!matherr(&exc
)) {
93 #endif /* defined(_DOUBLE_IS_32BITS) */