about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96/s_roundl.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-25 10:52:45 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-25 10:52:45 -0400
commitd7826aa149d2e85128a7ecf8fadc950ab9fe7a22 (patch)
tree9aff1638197c1f9b2ed99c8d666bd1a0b42517cb /sysdeps/ieee754/ldbl-96/s_roundl.c
parent31ea014d8b09e6aa4f07cdb86c94ce50f1b92c2a (diff)
downloadglibc-d7826aa149d2e85128a7ecf8fadc950ab9fe7a22.tar.gz
glibc-d7826aa149d2e85128a7ecf8fadc950ab9fe7a22.tar.xz
glibc-d7826aa149d2e85128a7ecf8fadc950ab9fe7a22.zip
Use math_force_eval in more places
Diffstat (limited to 'sysdeps/ieee754/ldbl-96/s_roundl.c')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_roundl.c55
1 files changed, 25 insertions, 30 deletions
diff --git a/sysdeps/ieee754/ldbl-96/s_roundl.c b/sysdeps/ieee754/ldbl-96/s_roundl.c
index f1399cc209..833ae0d786 100644
--- a/sysdeps/ieee754/ldbl-96/s_roundl.c
+++ b/sysdeps/ieee754/ldbl-96/s_roundl.c
@@ -1,5 +1,5 @@
 /* Round long double to integer away from zero.
-   Copyright (C) 1997, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2007, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -38,15 +38,13 @@ __roundl (long double x)
     {
       if (j0 < 0)
 	{
-	  if (huge + x > 0.0)
+	  math_force_eval (huge + x);
+	  se &= 0x8000;
+	  i0 = i1 = 0;
+	  if (j0 == -1)
 	    {
-	      se &= 0x8000;
-	      i0 = i1 = 0;
-	      if (j0 == -1)
-		{
-		  se |= 0x3fff;
-		  i0 = 0x80000000;
-		}
+	      se |= 0x3fff;
+	      i0 = 0x80000000;
 	    }
 	}
       else
@@ -55,15 +53,14 @@ __roundl (long double x)
 	  if (((i0 & i) | i1) == 0)
 	    /* X is integral.  */
 	    return x;
-	  if (huge + x > 0.0)
-	    {
-	      /* Raise inexact if x != 0.  */
-	      u_int32_t j = i0 + (0x40000000 >> j0);
-	      if (j < i0)
-		se += 1;
-	      i0 = (j & ~i) | 0x80000000;
-	      i1 = 0;
-	    }
+
+	  /* Raise inexact if x != 0.  */
+	  math_force_eval (huge + x);
+	  u_int32_t j = i0 + (0x40000000 >> j0);
+	  if (j < i0)
+	    se += 1;
+	  i0 = (j & ~i) | 0x80000000;
+	  i1 = 0;
 	}
     }
   else if (j0 > 62)
@@ -81,22 +78,20 @@ __roundl (long double x)
 	/* X is integral.  */
 	return x;
 
-      if (huge + x > 0.0)
+      math_force_eval (huge + x);
+      /* Raise inexact if x != 0.  */
+      u_int32_t j = i1 + (1 << (62 - j0));
+      if (j < i1)
 	{
-	  /* Raise inexact if x != 0.  */
-	  u_int32_t j = i1 + (1 << (62 - j0));
-	  if (j < i1)
+	  u_int32_t k = i0 + 1;
+	  if (k < i0)
 	    {
-	      u_int32_t k = i0 + 1;
-	      if (k < i0)
-		{
-		  se += 1;
-		  k |= 0x80000000;
-		}
-	      i0 = k;
+	      se += 1;
+	      k |= 0x80000000;
 	    }
-	  i1 = j;
+	  i0 = k;
 	}
+      i1 = j;
       i1 &= ~i;
     }