diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-10-25 10:52:45 -0400 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-10-25 10:52:45 -0400 |
commit | d7826aa149d2e85128a7ecf8fadc950ab9fe7a22 (patch) | |
tree | 9aff1638197c1f9b2ed99c8d666bd1a0b42517cb /sysdeps/ieee754/dbl-64/s_round.c | |
parent | 31ea014d8b09e6aa4f07cdb86c94ce50f1b92c2a (diff) | |
download | glibc-d7826aa149d2e85128a7ecf8fadc950ab9fe7a22.tar.gz glibc-d7826aa149d2e85128a7ecf8fadc950ab9fe7a22.tar.xz glibc-d7826aa149d2e85128a7ecf8fadc950ab9fe7a22.zip |
Use math_force_eval in more places
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_round.c')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_round.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_round.c b/sysdeps/ieee754/dbl-64/s_round.c index 94fcde0e4c..f8a38163fc 100644 --- a/sysdeps/ieee754/dbl-64/s_round.c +++ b/sysdeps/ieee754/dbl-64/s_round.c @@ -1,5 +1,5 @@ /* Round double to integer away from zero. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -38,13 +38,12 @@ __round (double x) { if (j0 < 0) { - if (huge + x > 0.0) - { - i0 &= 0x80000000; - if (j0 == -1) - i0 |= 0x3ff00000; - i1 = 0; - } + math_force_eval (huge + x > 0.0); + + i0 &= 0x80000000; + if (j0 == -1) + i0 |= 0x3ff00000; + i1 = 0; } else { @@ -52,13 +51,12 @@ __round (double x) if (((i0 & i) | i1) == 0) /* X is integral. */ return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - i0 += 0x00080000 >> j0; - i0 &= ~i; - i1 = 0; - } + math_force_eval (huge + x > 0.0); + + /* Raise inexact if x != 0. */ + i0 += 0x00080000 >> j0; + i0 &= ~i; + i1 = 0; } } else if (j0 > 51) @@ -76,14 +74,13 @@ __round (double x) /* X is integral. */ return x; - if (huge + x > 0.0) - { - /* Raise inexact if x != 0. */ - u_int32_t j = i1 + (1 << (51 - j0)); - if (j < i1) - i0 += 1; - i1 = j; - } + math_force_eval (huge + x > 0.0); + + /* Raise inexact if x != 0. */ + u_int32_t j = i1 + (1 << (51 - j0)); + if (j < i1) + i0 += 1; + i1 = j; i1 &= ~i; } |