aboutsummaryrefslogtreecommitdiff
path: root/newlib/libm/math/wf_sqrt.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libm/math/wf_sqrt.c')
-rw-r--r--newlib/libm/math/wf_sqrt.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/newlib/libm/math/wf_sqrt.c b/newlib/libm/math/wf_sqrt.c
index 4536ba0ac..4107511ae 100644
--- a/newlib/libm/math/wf_sqrt.c
+++ b/newlib/libm/math/wf_sqrt.c
@@ -31,27 +31,12 @@
return __ieee754_sqrtf(x);
#else
float z;
- struct exception exc;
z = __ieee754_sqrtf(x);
if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
- if(x<(float)0.0) {
- /* sqrtf(negative) */
- exc.type = DOMAIN;
- exc.name = "sqrtf";
- exc.err = 0;
- exc.arg1 = exc.arg2 = (double)x;
- if (_LIB_VERSION == _SVID_)
- exc.retval = 0.0;
- else
- exc.retval = 0.0/0.0;
- if (_LIB_VERSION == _POSIX_)
- errno = EDOM;
- else if (!matherr(&exc)) {
- errno = EDOM;
- }
- if (exc.err != 0)
- errno = exc.err;
- return (float)exc.retval;
+ if(x<0.0f) {
+ /* sqrtf(negative) */
+ errno = EDOM;
+ return 0.0f/0.0f;
} else
return z;
#endif