This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix ldbl-128 nexttoward


Hi!

sparc64 nexttoward test fails, because nexttoward(0, -0.0L) returns 0, not
-0, similarly nexttoward(-0, 0.0L) returns -0. All other nexttoward
implementation return y, but actually the documentation speaks about x.

2000-10-09  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward): If x == y,
	return y not x.
	* manual/arith.texi (nextafter): Document it.
	* sysdeps/ieee754/ldbl-96/s_nexttoward.c: Fix a comment.

--- libc/manual/arith.texi.jj	Sat Sep 30 19:41:09 2000
+++ libc/manual/arith.texi	Mon Oct  9 10:10:49 2000
@@ -1640,7 +1640,7 @@ false, but @code{signbit (-0.0)} will re
 The @code{nextafter} function returns the next representable neighbor of
 @var{x} in the direction towards @var{y}.  The size of the step between
 @var{x} and the result depends on the type of the result.  If
-@math{@var{x} = @var{y}} the function simply returns @var{x}.  If either
+@math{@var{x} = @var{y}} the function simply returns @var{y}.  If either
 value is @code{NaN}, @code{NaN} is returned.  Otherwise
 a value corresponding to the value of the least significant bit in the
 mantissa is added or subtracted, depending on the direction.
--- libc/sysdeps/ieee754/ldbl-128/s_nexttoward.c.jj	Wed Jul 14 02:09:39 1999
+++ libc/sysdeps/ieee754/ldbl-128/s_nexttoward.c	Mon Oct  9 10:07:03 2000
@@ -50,7 +50,7 @@ static char rcsid[] = "$NetBSD: $";
 	   ((iy>=0x7fff000000000000LL)&&((iy-0x7fff000000000000LL)|ly)!=0))
 	   						    /* y is nan */
 	   return x+y;
-	if((long double) x==y) return x;	/* x=y, return x */
+	if((long double) x==y) return y;	/* x=y, return y */
 	if((ix|lx)==0) {			/* x == 0 */
 	    double x2;
 	    INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */
--- libc/sysdeps/ieee754/ldbl-96/s_nexttoward.c.jj	Fri Oct 22 08:29:04 1999
+++ libc/sysdeps/ieee754/ldbl-96/s_nexttoward.c	Mon Oct  9 10:07:50 2000
@@ -19,7 +19,7 @@ static char rcsid[] = "$NetBSD: $";
 #endif
 
 /* IEEE functions
- *	nextafterx(x,y)
+ *	nexttoward(x,y)
  *	return the next machine floating-point number of x in the
  *	direction toward y.
  *   Special cases:

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]