Module Name:    src
Committed By:   christos
Date:           Sat Feb  9 23:14:44 UTC 2013

Modified Files:
        src/lib/libm/src: s_nearbyint.c s_nexttowardf.c s_rintl.c

Log Message:
make these only work for things that have EXT_ foo definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_nearbyint.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libm/src/s_nexttowardf.c \
    src/lib/libm/src/s_rintl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libm/src/s_nearbyint.c
diff -u src/lib/libm/src/s_nearbyint.c:1.1 src/lib/libm/src/s_nearbyint.c:1.2
--- src/lib/libm/src/s_nearbyint.c:1.1	Sat Feb  9 14:37:48 2013
+++ src/lib/libm/src/s_nearbyint.c	Sat Feb  9 18:14:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_nearbyint.c,v 1.1 2013/02/09 19:37:48 christos Exp $	*/
+/*	$NetBSD: s_nearbyint.c,v 1.2 2013/02/09 23:14:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004 David Schultz <[email protected]>
@@ -30,9 +30,10 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_nearbyint.c,v 1.2 2008/01/14 02:12:06 das Exp $");
 #else
-__RCSID("$NetBSD: s_nearbyint.c,v 1.1 2013/02/09 19:37:48 christos Exp $");
+__RCSID("$NetBSD: s_nearbyint.c,v 1.2 2013/02/09 23:14:44 christos Exp $");
 #endif
 
+#include <machine/ieee.h>
 #include <fenv.h>
 #include <math.h>
 
@@ -58,4 +59,6 @@ fn(type x)			\
 
 DECL(double, nearbyint, rint)
 DECL(float, nearbyintf, rintf)
+#ifdef EXT_FRACBITS
 DECL(long double, nearbyintl, rintl)
+#endif

Index: src/lib/libm/src/s_nexttowardf.c
diff -u src/lib/libm/src/s_nexttowardf.c:1.2 src/lib/libm/src/s_nexttowardf.c:1.3
--- src/lib/libm/src/s_nexttowardf.c:1.2	Sat Feb  9 15:19:13 2013
+++ src/lib/libm/src/s_nexttowardf.c	Sat Feb  9 18:14:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_nexttowardf.c,v 1.2 2013/02/09 20:19:13 christos Exp $	*/
+/*	$NetBSD: s_nexttowardf.c,v 1.3 2013/02/09 23:14:44 christos Exp $	*/
 
 /*
  * ====================================================
@@ -15,10 +15,12 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_nexttowardf.c,v 1.3 2011/02/10 07:38:38 das Exp $");
 #else
-__RCSID("$NetBSD: s_nexttowardf.c,v 1.2 2013/02/09 20:19:13 christos Exp $");
+__RCSID("$NetBSD: s_nexttowardf.c,v 1.3 2013/02/09 23:14:44 christos Exp $");
 #endif
 
+#include <string.h>
 #include <float.h>
+#include <machine/ieee.h>
 
 #include "math.h"
 #include "math_private.h"
@@ -34,15 +36,13 @@ nexttowardf(float x, long double y)
 	GET_FLOAT_WORD(hx,x);
 	ix = hx&0x7fffffff;		/* |x| */
 
-	memset(&u, 0, sizeof u);
+	memset(&uy, 0, sizeof(uy));
 	uy.extu_ld = y;
 	uy.extu_ext.ext_frach &= ~0x80000000;
 
-        union ieee_single_u u[2];
-
 	if((ix>0x7f800000) ||
 	   (uy.extu_ext.ext_exp == EXT_EXP_INFNAN &&
-	    (uy.extu_ext.ext_frach | uy.extu_ext.ext_fracl) != 0)
+	    (uy.extu_ext.ext_frach | uy.extu_ext.ext_fracl) != 0))
 	   return x+y;	/* x or y is nan */
 	if(x==y) return (float)y;		/* x=y, return y */
 	if(ix==0) {				/* x == 0 */
@@ -50,7 +50,7 @@ nexttowardf(float x, long double y)
 	    t = x*x;
 	    if(t==x) return t; else return x;	/* raise underflow flag */
 	}
-	if(hx>=0 ^ x < y)			/* x -= ulp */
+	if((hx >= 0) ^ (x < y))			/* x -= ulp */
 	    hx -= 1;
 	else					/* x += ulp */
 	    hx += 1;
Index: src/lib/libm/src/s_rintl.c
diff -u src/lib/libm/src/s_rintl.c:1.2 src/lib/libm/src/s_rintl.c:1.3
--- src/lib/libm/src/s_rintl.c:1.2	Sat Feb  9 17:33:13 2013
+++ src/lib/libm/src/s_rintl.c	Sat Feb  9 18:14:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_rintl.c,v 1.2 2013/02/09 22:33:13 christos Exp $	*/
+/*	$NetBSD: s_rintl.c,v 1.3 2013/02/09 23:14:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 David Schultz <[email protected]>
@@ -30,11 +30,14 @@
 #if 0
 __FBSDID("$FreeBSD: src/lib/msun/src/s_rintl.c,v 1.5 2008/02/22 11:59:05 bde Exp $");
 #else
-__RCSID("$NetBSD: s_rintl.c,v 1.2 2013/02/09 22:33:13 christos Exp $");
+__RCSID("$NetBSD: s_rintl.c,v 1.3 2013/02/09 23:14:44 christos Exp $");
 #endif
 
 #include <float.h>
-#include <math.h>
+#include <machine/ieee.h>
+
+#include "math.h"
+#include "math_private.h"
 
 #ifdef EXT_EXP_BIAS
 static const float

Reply via email to