summaryrefslogtreecommitdiff
path: root/libc/sysdeps/ieee754/flt-32/s_scalblnf.c
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-03-03 18:18:04 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-03-03 18:18:04 +0000
commitc0102611b1f1bd1ce2a2952e9b74ff33fa02717e (patch)
tree31177266a6797f3c30d0493619d0f06f3f59afe1 /libc/sysdeps/ieee754/flt-32/s_scalblnf.c
parent33f3f8954d202664c7c7a224d13ba5a0c14a0e01 (diff)
Merge changes between r17194 and r17384 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@17385 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/ieee754/flt-32/s_scalblnf.c')
-rw-r--r--libc/sysdeps/ieee754/flt-32/s_scalblnf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libc/sysdeps/ieee754/flt-32/s_scalblnf.c b/libc/sysdeps/ieee754/flt-32/s_scalblnf.c
index 5256c3259..2a2d7ab65 100644
--- a/libc/sysdeps/ieee754/flt-32/s_scalblnf.c
+++ b/libc/sysdeps/ieee754/flt-32/s_scalblnf.c
@@ -35,11 +35,13 @@ __scalblnf (float x, long int n)
k = ((ix&0x7f800000)>>23) - 25;
}
if (__builtin_expect(k==0xff, 0)) return x+x; /* NaN or Inf */
- k = k+n;
- if (__builtin_expect(n> 50000 || k > 0xfe, 0))
- return huge*copysignf(huge,x); /* overflow */
if (__builtin_expect(n< -50000, 0))
return tiny*copysignf(tiny,x); /*underflow*/
+ if (__builtin_expect(n> 50000 || k+n > 0xfe, 0))
+ return huge*copysignf(huge,x); /* overflow */
+ /* Now k and n are bounded we know that k = k+n does not
+ overflow. */
+ k = k+n;
if (__builtin_expect(k > 0, 1)) /* normal result */
{SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;}
if (k <= -25)