2004-05-26 04:47:00 +00:00
|
|
|
/* Double-precision floating point square root wrapper.
|
2013-01-02 19:01:50 +00:00
|
|
|
Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
1997-08-29 01:19:12 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1997-08-29 01:19:12 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
1997-08-29 01:19:12 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1997-08-29 01:19:12 +00:00
|
|
|
|
2012-03-09 19:29:16 +00:00
|
|
|
#include <math.h>
|
|
|
|
#include <math_private.h>
|
1997-08-29 01:19:12 +00:00
|
|
|
#include <fenv_libc.h>
|
2013-03-21 17:15:45 +00:00
|
|
|
#include <math_ldbl_opt.h>
|
1997-08-29 01:19:12 +00:00
|
|
|
|
|
|
|
double
|
2004-05-26 04:47:00 +00:00
|
|
|
__sqrt (double x) /* wrapper sqrt */
|
|
|
|
{
|
|
|
|
#ifdef _IEEE_LIBM
|
|
|
|
return __ieee754_sqrt (x);
|
|
|
|
#else
|
|
|
|
double z;
|
|
|
|
z = __ieee754_sqrt (x);
|
|
|
|
if (_LIB_VERSION == _IEEE_ || (x != x))
|
|
|
|
return z;
|
|
|
|
|
|
|
|
if (x < 0.0)
|
|
|
|
return __kernel_standard (x, x, 26); /* sqrt(negative) */
|
|
|
|
else
|
|
|
|
return z;
|
1997-08-29 01:19:12 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
weak_alias (__sqrt, sqrt)
|
2002-05-10 18:39:46 +00:00
|
|
|
#ifdef NO_LONG_DOUBLE
|
2004-05-26 04:47:00 +00:00
|
|
|
strong_alias (__sqrt, __sqrtl) weak_alias (__sqrt, sqrtl)
|
2002-05-10 18:39:46 +00:00
|
|
|
#endif
|
2013-03-21 17:15:45 +00:00
|
|
|
#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
|
|
|
|
compat_symbol (libm, __sqrt, sqrtl, GLIBC_2_0);
|
|
|
|
#endif
|