aboutsummaryrefslogtreecommitdiff
path: root/newlib/libm/math/wf_scalb.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libm/math/wf_scalb.c')
-rw-r--r--newlib/libm/math/wf_scalb.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/newlib/libm/math/wf_scalb.c b/newlib/libm/math/wf_scalb.c
index d2c3cd2aa..acdf8a80d 100644
--- a/newlib/libm/math/wf_scalb.c
+++ b/newlib/libm/math/wf_scalb.c
@@ -47,42 +47,17 @@
SET_HIGH_WORD(inf,0x7ff00000); /* set inf to infinite */
#endif
- struct exception exc;
z = __ieee754_scalbf(x,fn);
if(_LIB_VERSION == _IEEE_) return z;
if(!(finitef(z)||isnan(z))&&finitef(x)) {
- /* scalbf overflow; SVID also returns +-HUGE_VAL */
- exc.type = OVERFLOW;
- exc.name = "scalbf";
- exc.err = 0;
- exc.arg1 = (double)x;
- exc.arg2 = (double)fn;
- exc.retval = x > 0.0 ? HUGE_VAL : -HUGE_VAL;
- if (_LIB_VERSION == _POSIX_)
- errno = ERANGE;
- else if (!matherr(&exc)) {
- errno = ERANGE;
- }
- if (exc.err != 0)
- errno = exc.err;
- return exc.retval;
+ /* scalbf overflow; */
+ errno = ERANGE;
+ return (x > 0.0 ? HUGE_VAL : -HUGE_VAL);
}
- if(z==(float)0.0&&z!=x) {
+ if(z==0.0f&&z!=x) {
/* scalbf underflow */
- exc.type = UNDERFLOW;
- exc.name = "scalbf";
- exc.err = 0;
- exc.arg1 = (double)x;
- exc.arg2 = (double)fn;
- exc.retval = copysign(0.0,x);
- if (_LIB_VERSION == _POSIX_)
- errno = ERANGE;
- else if (!matherr(&exc)) {
- errno = ERANGE;
- }
- if (exc.err != 0)
- errno = exc.err;
- return exc.retval;
+ errno = ERANGE;
+ return copysign(0.0,x);
}
#ifndef _SCALB_INT
if(!finitef(fn)) errno = ERANGE;