about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64/s_lround.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_lround.c')
-rw-r--r--sysdeps/ieee754/dbl-64/s_lround.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_lround.c b/sysdeps/ieee754/dbl-64/s_lround.c
index 7c11c690ab..4e1302ad4d 100644
--- a/sysdeps/ieee754/dbl-64/s_lround.c
+++ b/sysdeps/ieee754/dbl-64/s_lround.c
@@ -1,5 +1,5 @@
 /* Round double value to long int.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -58,7 +58,10 @@ __lround (double x)
 	  if (j < i1)
 	    ++i0;
 
-	  result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0));
+	  if (j0 == 20)
+	    result = (long int) i0;
+	  else
+	    result = ((long int) i0 << (j0 - 20)) | (j >> (52 - j0));
 	}
     }
   else