Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libm/src Return x for >= DBL_FRACBITS in lrint.c.



details:   https://anonhg.NetBSD.org/src/rev/bc9df1ee026f
branches:  trunk
changeset: 339264:bc9df1ee026f
user:      nat <nat%NetBSD.org@localhost>
date:      Thu Jul 09 06:17:13 2015 +0000

description:
Return x for >= DBL_FRACBITS in lrint.c.
Return x for >= SNG_FRACBITS in lrintf.c

Addresses PR lib/49690

This commit was approved by christos@

diffstat:

 lib/libm/src/lrint.c  |  5 +++--
 lib/libm/src/lrintf.c |  5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 8db9aa641db7 -r bc9df1ee026f lib/libm/src/lrint.c
--- a/lib/libm/src/lrint.c      Wed Jul 08 19:48:20 2015 +0000
+++ b/lib/libm/src/lrint.c      Thu Jul 09 06:17:13 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lrint.c,v 1.4 2008/04/26 23:49:50 christos Exp $ */
+/* $NetBSD: lrint.c,v 1.5 2015/07/09 06:17:13 nat Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -70,7 +70,8 @@
                /* round, using current direction */
                x += TWO52[s];
                x -= TWO52[s];
-       }
+       } else
+               return x;
 
        EXTRACT_WORDS(i0, i1, x);
        e = ((i0 >> 20) & 0x7ff) - DBL_EXP_BIAS;
diff -r 8db9aa641db7 -r bc9df1ee026f lib/libm/src/lrintf.c
--- a/lib/libm/src/lrintf.c     Wed Jul 08 19:48:20 2015 +0000
+++ b/lib/libm/src/lrintf.c     Thu Jul 09 06:17:13 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lrintf.c,v 1.5 2008/04/26 23:49:50 christos Exp $ */
+/* $NetBSD: lrintf.c,v 1.6 2015/07/09 06:17:13 nat Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -74,7 +74,8 @@
                /* round, using current direction */
                w = TWO23[s] + x;
                x = w - TWO23[s];
-       }
+       } else
+               return x;
 
        GET_FLOAT_WORD(i0, x);
        e = ((i0 >> SNG_FRACBITS) & 0xff) - SNG_EXP_BIAS;



Home | Main Index | Thread Index | Old Index