# define USE_COPYSIGNF128_BUILTIN 0
#endif
+#define USE_SQRT_BUILTIN 0
+#define USE_SQRTF_BUILTIN 0
+
#endif /* math-use-builtins.h */
#include <math_private.h>
#include <fenv_private.h>
#include <libm-alias-finite.h>
+#include <math-use-builtins.h>
/*********************************************************************/
/* An ultimate sqrt routine. Given an IEEE double machine number x */
double
__ieee754_sqrt (double x)
{
+#if USE_SQRT_BUILTIN
+ return __builtin_sqrt (x);
+#else
+ /* Use generic implementation. */
static const double
rt0 = 9.99999999859990725855365213134618E-01,
rt1 = 4.99999999495955425917856814202739E-01,
return (x - x) / (x - x); /* sqrt(-ve)=sNaN */
return 0x1p-256 * __ieee754_sqrt (x * 0x1p512);
}
+#endif /* ! USE_SQRT_BUILTIN */
}
#ifndef __ieee754_sqrt
libm_alias_finite (__ieee754_sqrt, __sqrt)
#include <math.h>
#include <math_private.h>
#include <libm-alias-finite.h>
-
-static const float one = 1.0, tiny=1.0e-30;
+#include <math-use-builtins.h>
float
__ieee754_sqrtf(float x)
{
+#if USE_SQRTF_BUILTIN
+ return __builtin_sqrtf (x);
+#else
+ /* Use generic implementation. */
float z;
int32_t sign = (int)0x80000000;
int32_t ix,s,q,m,t,i;
/* use floating add to find out rounding direction */
if(ix!=0) {
- z = one-tiny; /* trigger inexact flag */
- if (z>=one) {
- z = one+tiny;
- if (z>one)
+ z = 0x1p0 - 0x1.4484cp-100; /* trigger inexact flag. */
+ if (z >= 0x1p0) {
+ z = 0x1p0 + 0x1.4484cp-100;
+ if (z > 0x1p0)
q += 2;
else
q += (q&1);
ix += (m <<23);
SET_FLOAT_WORD(z,ix);
return z;
+#endif /* ! USE_SQRTF_BUILTIN */
}
#ifndef __ieee754_sqrtf
libm_alias_finite (__ieee754_sqrtf, __sqrtf)
# define USE_COPYSIGNF128_BUILTIN 0
#endif
+#define USE_SQRT_BUILTIN 0
+#define USE_SQRTF_BUILTIN 0
+
#endif /* math-use-builtins.h */