Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Sep 2008 17:17:04 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 149212 for review
Message-ID:  <200809041717.m84HH4hr076312@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=149212

Change 149212 by ed@ed_dull on 2008/09/04 17:16:23

	IFC.

Affected files ...

.. //depot/projects/mpsafetty/UPDATING#9 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/README#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/dtoa.c#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/gdtoa.h#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/gdtoaimp.h#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/gethex.c#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/strtoIg.c#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/strtod.c#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/strtodg.c#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/strtof.c#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/test/README#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/test/f.out#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/test/getround.c#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/test/xsum0.out#2 integrate
.. //depot/projects/mpsafetty/contrib/gdtoa/xsum0.out#2 integrate
.. //depot/projects/mpsafetty/lib/libarchive/archive_write_disk.3#2 integrate
.. //depot/projects/mpsafetty/lib/librpcsec_gss/svc_rpcsec_gss.c#2 integrate
.. //depot/projects/mpsafetty/lib/libstand/stand.h#2 integrate
.. //depot/projects/mpsafetty/lib/libstand/ufs.c#2 integrate
.. //depot/projects/mpsafetty/lib/libstand/zalloc_malloc.c#2 integrate
.. //depot/projects/mpsafetty/libexec/rtld-elf/rtld.c#2 integrate
.. //depot/projects/mpsafetty/sys/amd64/amd64/cpu_switch.S#3 integrate
.. //depot/projects/mpsafetty/sys/amd64/amd64/machdep.c#3 integrate
.. //depot/projects/mpsafetty/sys/amd64/ia32/ia32_signal.c#3 integrate
.. //depot/projects/mpsafetty/sys/boot/common/dev_net.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/common/devopen.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/powerpc/uboot/Makefile#2 integrate
.. //depot/projects/mpsafetty/sys/boot/powerpc/uboot/metadata.c#2 delete
.. //depot/projects/mpsafetty/sys/boot/powerpc/uboot/start.S#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/common/Makefile.inc#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/common/main.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/common/metadata.c#1 branch
.. //depot/projects/mpsafetty/sys/boot/uboot/lib/Makefile#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/lib/console.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/lib/elf_freebsd.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/lib/glue.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/lib/glue.h#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/lib/net.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/lib/reboot.c#2 integrate
.. //depot/projects/mpsafetty/sys/boot/uboot/lib/time.c#2 integrate
.. //depot/projects/mpsafetty/sys/conf/files.sun4v#2 integrate
.. //depot/projects/mpsafetty/sys/dev/ata/ata-chipset.c#5 integrate
.. //depot/projects/mpsafetty/sys/dev/ata/ata-pci.h#4 integrate
.. //depot/projects/mpsafetty/sys/dev/cxgb/cxgb_main.c#6 integrate
.. //depot/projects/mpsafetty/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/k8temp/k8temp.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/mii/e1000phy.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/mii/miidevs#2 integrate
.. //depot/projects/mpsafetty/sys/dev/pci/pci_pci.c#6 integrate
.. //depot/projects/mpsafetty/sys/fs/tmpfs/tmpfs.h#2 integrate
.. //depot/projects/mpsafetty/sys/fs/tmpfs/tmpfs_fifoops.c#2 integrate
.. //depot/projects/mpsafetty/sys/fs/tmpfs/tmpfs_fifoops.h#2 integrate
.. //depot/projects/mpsafetty/sys/fs/tmpfs/tmpfs_subr.c#2 integrate
.. //depot/projects/mpsafetty/sys/fs/tmpfs/tmpfs_vfsops.c#3 integrate
.. //depot/projects/mpsafetty/sys/fs/tmpfs/tmpfs_vnops.c#3 integrate
.. //depot/projects/mpsafetty/sys/fs/tmpfs/tmpfs_vnops.h#2 integrate
.. //depot/projects/mpsafetty/sys/i386/xen/locore.s#3 integrate
.. //depot/projects/mpsafetty/sys/kern/kern_proc.c#6 integrate
.. //depot/projects/mpsafetty/sys/kern/tty.c#37 integrate
.. //depot/projects/mpsafetty/sys/kern/tty_compat.c#4 integrate
.. //depot/projects/mpsafetty/sys/kern/tty_pts.c#19 integrate
.. //depot/projects/mpsafetty/sys/kern/tty_ttydisc.c#20 edit
.. //depot/projects/mpsafetty/sys/kern/vfs_mount.c#8 integrate
.. //depot/projects/mpsafetty/sys/mips/adm5120/std.adm5120#2 integrate
.. //depot/projects/mpsafetty/sys/mips/conf/ADM5120#2 integrate
.. //depot/projects/mpsafetty/sys/mips/conf/IDT#2 integrate
.. //depot/projects/mpsafetty/sys/mips/conf/MALTA#2 integrate
.. //depot/projects/mpsafetty/sys/mips/conf/SENTRY5#2 integrate
.. //depot/projects/mpsafetty/sys/mips/idt/std.idt#2 integrate
.. //depot/projects/mpsafetty/sys/mips/malta/files.malta#2 integrate
.. //depot/projects/mpsafetty/sys/mips/malta/std.malta#2 integrate
.. //depot/projects/mpsafetty/sys/mips/mips/in_cksum.c#2 integrate
.. //depot/projects/mpsafetty/sys/mips/mips/intr_machdep.c#2 integrate
.. //depot/projects/mpsafetty/sys/net80211/ieee80211.c#3 integrate
.. //depot/projects/mpsafetty/sys/netgraph/ng_pipe.c#1 branch
.. //depot/projects/mpsafetty/sys/netgraph/ng_pipe.h#1 branch
.. //depot/projects/mpsafetty/sys/netinet/ip_fw2.c#6 integrate
.. //depot/projects/mpsafetty/sys/netinet6/icmp6.c#5 integrate
.. //depot/projects/mpsafetty/sys/netinet6/mld6.c#3 integrate
.. //depot/projects/mpsafetty/sys/security/audit/audit_syscalls.c#6 integrate
.. //depot/projects/mpsafetty/sys/sparc64/conf/GENERIC#8 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/cache.h#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/clock.h#2 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/cpufunc.h#4 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/pcpu.h#4 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/smp.h#2 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/tick.h#2 integrate
.. //depot/projects/mpsafetty/sys/sparc64/include/ver.h#2 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/autoconf.c#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/cache.c#2 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/cheetah.c#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/clock.c#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/exception.S#4 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/genassym.c#2 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/locore.S#4 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/machdep.c#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/mp_exception.S#2 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/mp_locore.S#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/mp_machdep.c#4 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/spitfire.c#3 integrate
.. //depot/projects/mpsafetty/sys/sparc64/sparc64/tick.c#3 integrate
.. //depot/projects/mpsafetty/sys/sun4v/sun4v/clock.c#1 branch
.. //depot/projects/mpsafetty/sys/sys/tty.h#15 integrate
.. //depot/projects/mpsafetty/sys/sys/ttydevsw.h#7 integrate
.. //depot/projects/mpsafetty/sys/ufs/ffs/ffs_vnops.c#2 integrate
.. //depot/projects/mpsafetty/sys/ufs/ufs/ufs_extattr.c#2 integrate
.. //depot/projects/mpsafetty/tools/regression/lib/libc/stdio/test-scanfloat.c#2 integrate
.. //depot/projects/mpsafetty/tools/tools/nanobsd/nanobsd.sh#6 integrate
.. //depot/projects/mpsafetty/usr.bin/cpio/cpio.c#6 integrate
.. //depot/projects/mpsafetty/usr.bin/limits/limits.1#2 integrate
.. //depot/projects/mpsafetty/usr.bin/limits/limits.c#2 integrate
.. //depot/projects/mpsafetty/usr.sbin/crunch/crunchide/exec_elf32.c#2 integrate
.. //depot/projects/mpsafetty/usr.sbin/cxgbtool/reg_defs_t3c.c#1 branch
.. //depot/projects/mpsafetty/usr.sbin/pciconf/pciconf.c#2 integrate

Differences ...

==== //depot/projects/mpsafetty/UPDATING#9 (text+ko) ====

@@ -41,6 +41,9 @@
 	Adding these drivers to your kernel configuration file shall
 	cause compilation to fail.
 
+20080818:
+	ntpd has been upgraded to 4.2.4p5.
+
 20080801:
 	OpenSSH has been upgraded to 5.1p1.
 
@@ -1123,4 +1126,4 @@
 Contact Warner Losh if you have any questions about your use of
 this document.
 
-$FreeBSD: src/UPDATING,v 1.540 2008/09/01 23:50:56 des Exp $
+$FreeBSD: src/UPDATING,v 1.541 2008/09/03 08:30:17 roberto Exp $

==== //depot/projects/mpsafetty/contrib/gdtoa/README#2 (text+ko) ====

@@ -332,5 +332,15 @@
 the decimal-point character to be taken from the current locale; otherwise
 it is '.'.
 
+Source files dtoa.c and strtod.c in this directory are derived from
+netlib's "dtoa.c from fp" and are meant to function equivalently.
+When compiled with Honor_FLT_ROUNDS #defined (on systems that provide
+FLT_ROUNDS and fegetround() as specified in the C99 standard), they
+honor the current rounding mode.  Because FLT_ROUNDS is buggy on some
+(Linux) systems -- not reflecting calls on fesetround(), as the C99
+standard says it should -- when Honor_FLT_ROUNDS is #defined, the
+current rounding mode is obtained from fegetround() rather than from
+FLT_ROUNDS, unless Trust_FLT_ROUNDS is also #defined.
+
 Please send comments to	David M. Gay (dmg at acm dot org, with " at "
 changed at "@" and " dot " changed to ".").

==== //depot/projects/mpsafetty/contrib/gdtoa/dtoa.c#2 (text+ko) ====

@@ -66,7 +66,6 @@
  */
 
 #ifdef Honor_FLT_ROUNDS
-#define Rounding rounding
 #undef Check_FLT_ROUNDS
 #define Check_FLT_ROUNDS
 #else
@@ -127,12 +126,22 @@
 	Bigint *b, *b1, *delta, *mlo, *mhi, *S;
 	double d2, ds, eps;
 	char *s, *s0;
-#ifdef Honor_FLT_ROUNDS
-	int rounding;
-#endif
 #ifdef SET_INEXACT
 	int inexact, oldinexact;
 #endif
+#ifdef Honor_FLT_ROUNDS /*{*/
+	int Rounding;
+#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */
+	Rounding = Flt_Rounds;
+#else /*}{*/
+	Rounding = 1;
+	switch(fegetround()) {
+	  case FE_TOWARDZERO:	Rounding = 0; break;
+	  case FE_UPWARD:	Rounding = 2; break;
+	  case FE_DOWNWARD:	Rounding = 3;
+	  }
+#endif /*}}*/
+#endif /*}*/
 
 #ifndef MULTIPLE_THREADS
 	if (dtoa_result) {
@@ -178,12 +187,12 @@
 	inexact = 1;
 #endif
 #ifdef Honor_FLT_ROUNDS
-	if ((rounding = Flt_Rounds) >= 2) {
+	if (Rounding >= 2) {
 		if (*sign)
-			rounding = rounding == 2 ? 0 : 2;
+			Rounding = Rounding == 2 ? 0 : 2;
 		else
-			if (rounding != 2)
-				rounding = 0;
+			if (Rounding != 2)
+				Rounding = 0;
 		}
 #endif
 
@@ -316,7 +325,7 @@
 	s = s0 = rv_alloc(i);
 
 #ifdef Honor_FLT_ROUNDS
-	if (mode > 1 && rounding != 1)
+	if (mode > 1 && Rounding != 1)
 		leftright = 0;
 #endif
 
@@ -453,7 +462,7 @@
 			if (i == ilim) {
 #ifdef Honor_FLT_ROUNDS
 				if (mode > 1)
-				switch(rounding) {
+				switch(Rounding) {
 				  case 0: goto ret1;
 				  case 2: goto bump_up;
 				  }
@@ -521,7 +530,7 @@
 	spec_case = 0;
 	if ((mode < 2 || leftright)
 #ifdef Honor_FLT_ROUNDS
-			&& rounding == 1
+			&& Rounding == 1
 #endif
 				) {
 		if (!word1(d) && !(word0(d) & Bndry_mask)
@@ -614,7 +623,7 @@
 #ifndef ROUND_BIASED
 			if (j1 == 0 && mode != 1 && !(word1(d) & 1)
 #ifdef Honor_FLT_ROUNDS
-				&& rounding >= 1
+				&& Rounding >= 1
 #endif
 								   ) {
 				if (dig == '9')
@@ -642,7 +651,7 @@
 					}
 #ifdef Honor_FLT_ROUNDS
 				if (mode > 1)
-				 switch(rounding) {
+				 switch(Rounding) {
 				  case 0: goto accept_dig;
 				  case 2: goto keep_dig;
 				  }
@@ -660,7 +669,7 @@
 				}
 			if (j1 > 0) {
 #ifdef Honor_FLT_ROUNDS
-				if (!rounding)
+				if (!Rounding)
 					goto accept_dig;
 #endif
 				if (dig == '9') { /* possible if i == 1 */
@@ -703,7 +712,7 @@
 	/* Round off last digit */
 
 #ifdef Honor_FLT_ROUNDS
-	switch(rounding) {
+	switch(Rounding) {
 	  case 0: goto trimzeros;
 	  case 2: goto roundoff;
 	  }

==== //depot/projects/mpsafetty/contrib/gdtoa/gdtoa.h#2 (text+ko) ====

@@ -74,9 +74,9 @@
 
 	/* The following may be or-ed into one of the above values. */
 
-	STRTOG_Neg	= 0x08,
-	STRTOG_Inexlo	= 0x10,
-	STRTOG_Inexhi	= 0x20,
+	STRTOG_Neg	= 0x08, /* does not affect STRTOG_Inexlo or STRTOG_Inexhi */
+	STRTOG_Inexlo	= 0x10,	/* returned result rounded toward zero */
+	STRTOG_Inexhi	= 0x20, /* returned result rounded away from zero */
 	STRTOG_Inexact	= 0x30,
 	STRTOG_Underflow= 0x40,
 	STRTOG_Overflow	= 0x80

==== //depot/projects/mpsafetty/contrib/gdtoa/gdtoaimp.h#2 (text+ko) ====

@@ -26,7 +26,7 @@
 
 ****************************************************************/
 
-/* $FreeBSD: src/contrib/gdtoa/gdtoaimp.h,v 1.9 2007/12/17 00:19:49 das Exp $ */
+/* $FreeBSD: src/contrib/gdtoa/gdtoaimp.h,v 1.10 2008/09/03 07:23:57 das Exp $ */
 
 /* This is a variation on dtoa.c that converts arbitary binary
    floating-point formats to and from decimal notation.  It uses
@@ -132,13 +132,16 @@
  *	Infinity and NaN (case insensitively).
  *	When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined,
  *	strtodg also accepts (case insensitively) strings of the form
- *	NaN(x), where x is a string of hexadecimal digits and spaces;
- *	if there is only one string of hexadecimal digits, it is taken
- *	for the fraction bits of the resulting NaN; if there are two or
- *	more strings of hexadecimal digits, each string is assigned
- *	to the next available sequence of 32-bit words of fractions
- *	bits (starting with the most significant), right-aligned in
- *	each sequence.
+ *	NaN(x), where x is a string of hexadecimal digits (optionally
+ *	preceded by 0x or 0X) and spaces; if there is only one string
+ *	of hexadecimal digits, it is taken for the fraction bits of the
+ *	resulting NaN; if there are two or more strings of hexadecimal
+ *	digits, each string is assigned to the next available sequence
+ *	of 32-bit words of fractions bits (starting with the most
+ *	significant), right-aligned in each sequence.
+ *	Unless GDTOA_NON_PEDANTIC_NANCHECK is #defined, input "NaN(...)"
+ *	is consumed even when ... has the wrong form (in which case the
+ *	"(...)" is consumed but ignored).
  * #define MULTIPLE_THREADS if the system offers preemptively scheduled
  *	multiple threads.  In this case, you must provide (or suitably
  *	#define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed
@@ -150,7 +153,7 @@
  *	dtoa.  You may do so whether or not MULTIPLE_THREADS is #defined.
  * #define IMPRECISE_INEXACT if you do not care about the setting of
  *	the STRTOG_Inexact bits in the special case of doing IEEE double
- *	precision conversions (which could also be done by the strtog in
+ *	precision conversions (which could also be done by the strtod in
  *	dtoa.c).
  * #define NO_HEX_FP to disable recognition of C9x's hexadecimal
  *	floating-point constants.
@@ -204,6 +207,7 @@
 #define INFNAN_CHECK
 #define USE_LOCALE
 #define Honor_FLT_ROUNDS
+#define Trust_FLT_ROUNDS
 
 #undef IEEE_Arith
 #undef Avoid_Underflow
@@ -597,7 +601,7 @@
  extern int cmp ANSI((Bigint*, Bigint*));
  extern void copybits ANSI((ULong*, int, Bigint*));
  extern Bigint *d2b ANSI((double, int*, int*));
- extern int decrement ANSI((Bigint*));
+ extern void decrement ANSI((Bigint*));
  extern Bigint *diff ANSI((Bigint*, Bigint*));
  extern char *dtoa ANSI((double d, int mode, int ndigits,
 			int *decpt, int *sign, char **rve));

==== //depot/projects/mpsafetty/contrib/gdtoa/gethex.c#2 (text+ko) ====

@@ -45,7 +45,7 @@
 {
 	Bigint *b;
 	CONST unsigned char *decpt, *s0, *s, *s1;
-	int esign, havedig, irv, k, n, nbits, up, zret;
+	int big, esign, havedig, irv, j, k, n, n0, nbits, up, zret;
 	ULong L, lostbits, *x;
 	Long e, e1;
 #ifdef USE_LOCALE
@@ -56,6 +56,7 @@
 
 	if (!hexdig['0'])
 		hexdig_init_D2A();
+	*bp = 0;
 	havedig = 0;
 	s0 = *(CONST unsigned char **)sp + 2;
 	while(s0[havedig] == '0')
@@ -90,10 +91,10 @@
 		e = -(((Long)(s-decpt)) << 2);
  pcheck:
 	s1 = s;
+	big = esign = 0;
 	switch(*s) {
 	  case 'p':
 	  case 'P':
-		esign = 0;
 		switch(*++s) {
 		  case '-':
 			esign = 1;
@@ -106,17 +107,65 @@
 			break;
 			}
 		e1 = n - 0x10;
-		while((n = hexdig[*++s]) !=0 && n <= 0x19)
+		while((n = hexdig[*++s]) !=0 && n <= 0x19) {
+			if (e1 & 0xf8000000)
+				big = 1;
 			e1 = 10*e1 + n - 0x10;
+			}
 		if (esign)
 			e1 = -e1;
 		e += e1;
 	  }
 	*sp = (char*)s;
-	if (zret) {
-		if (!havedig)
-			*sp = s0 - 1;
+	if (!havedig)
+		*sp = s0 - 1;
+	if (zret)
 		return STRTOG_Zero;
+	if (big) {
+		if (esign) {
+			switch(fpi->rounding) {
+			  case FPI_Round_up:
+				if (sign)
+					break;
+				goto ret_tiny;
+			  case FPI_Round_down:
+				if (!sign)
+					break;
+				goto ret_tiny;
+			  }
+			goto retz;
+ ret_tiny:
+			b = Balloc(0);
+			b->wds = 1;
+			b->x[0] = 1;
+			goto dret;
+			}
+		switch(fpi->rounding) {
+		  case FPI_Round_near:
+			goto ovfl1;
+		  case FPI_Round_up:
+			if (!sign)
+				goto ovfl1;
+			goto ret_big;
+		  case FPI_Round_down:
+			if (sign)
+				goto ovfl1;
+			goto ret_big;
+		  }
+ ret_big:
+		nbits = fpi->nbits;
+		n0 = n = nbits >> kshift;
+		if (nbits & kmask)
+			++n;
+		for(j = n, k = 0; j >>= 1; ++k);
+		*bp = b = Balloc(k);
+		b->wds = n;
+		for(j = 0; j < n0; ++j)
+			b->x[j] = ALL_ON;
+		if (n > n0)
+			b->x[j] = ULbits >> (ULbits - (nbits & kmask));
+		*exp = fpi->emin;
+		return STRTOG_Normal | STRTOG_Inexlo;
 		}
 	n = s1 - s0 - 1;
 	for(k = 0; n > 7; n >>= 1)
@@ -149,7 +198,7 @@
 			k = n - 1;
 			if (x[k>>kshift] & 1 << (k & kmask)) {
 				lostbits = 2;
-				if (k > 1 && any_on(b,k-1))
+				if (k > 0 && any_on(b,k))
 					lostbits = 3;
 				}
 			}
@@ -165,7 +214,10 @@
 	if (e > fpi->emax) {
  ovfl:
 		Bfree(b);
-		*bp = 0;
+ ovfl1:
+#ifndef NO_ERRNO
+		errno = ERANGE;
+#endif
 		return STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi;
 		}
 	irv = STRTOG_Normal;
@@ -185,15 +237,22 @@
 			  case FPI_Round_down:
 				if (sign) {
  one_bit:
-					*exp = fpi->emin;
 					x[0] = b->wds = 1;
+ dret:
 					*bp = b;
+					*exp = fpi->emin;
+#ifndef NO_ERRNO
+					errno = ERANGE;
+#endif
 					return STRTOG_Denormal | STRTOG_Inexhi
 						| STRTOG_Underflow;
 					}
 			  }
 			Bfree(b);
-			*bp = 0;
+ retz:
+#ifndef NO_ERRNO
+			errno = ERANGE;
+#endif
 			return STRTOG_Zero | STRTOG_Inexlo | STRTOG_Underflow;
 			}
 		k = n - 1;

==== //depot/projects/mpsafetty/contrib/gdtoa/strtoIg.c#2 (text+ko) ====

@@ -61,12 +61,16 @@
 	if (rv & STRTOG_Inexlo) {
 		swap = 0;
 		b1 = increment(b1);
-		if (fpi->sudden_underflow
-		 && (rv & STRTOG_Retmask) == STRTOG_Zero) {
-			b1->x[0] = 0;
-			b1->x[nw1] = 1L << nb11;
-			rv1 += STRTOG_Normal - STRTOG_Zero;
-			rv1 &= ~STRTOG_Underflow;
+		if ((rv & STRTOG_Retmask) == STRTOG_Zero) {
+			if (fpi->sudden_underflow) {
+				b1->x[0] = 0;
+				b1->x[nw1] = 1L << nb11;
+				rv1 += STRTOG_Normal - STRTOG_Zero;
+				rv1 &= ~STRTOG_Underflow;
+				goto swapcheck;
+				}
+			rv1 &= STRTOG_Inexlo | STRTOG_Underflow | STRTOG_Zero;
+			rv1 |= STRTOG_Inexhi | STRTOG_Denormal;
 			goto swapcheck;
 			}
 		if (b1->wds > nw

==== //depot/projects/mpsafetty/contrib/gdtoa/strtod.c#2 (text+ko) ====

@@ -29,7 +29,7 @@
 /* Please send bug reports to David M. Gay (dmg at acm dot org,
  * with " at " changed at "@" and " dot " changed to ".").	*/
 
-/* $FreeBSD: src/contrib/gdtoa/strtod.c,v 1.2 2007/12/16 21:14:33 das Exp $ */
+/* $FreeBSD: src/contrib/gdtoa/strtod.c,v 1.3 2008/09/03 07:23:57 das Exp $ */
 
 #include "gdtoaimp.h"
 #ifndef NO_FENV_H
@@ -44,16 +44,15 @@
 #ifndef NO_IEEE_Scale
 #define Avoid_Underflow
 #undef tinytens
-/* The factor of 2^53 in tinytens[4] helps us avoid setting the underflow */
+/* The factor of 2^106 in tinytens[4] helps us avoid setting the underflow */
 /* flag unnecessarily.  It leads to a song and dance at the end of strtod. */
 static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128,
-		9007199254740992.e-256
+		9007199254740992.*9007199254740992.e-256
 		};
 #endif
 #endif
 
 #ifdef Honor_FLT_ROUNDS
-#define Rounding rounding
 #undef Check_FLT_ROUNDS
 #define Check_FLT_ROUNDS
 #else
@@ -81,9 +80,19 @@
 #ifdef SET_INEXACT
 	int inexact, oldinexact;
 #endif
-#ifdef Honor_FLT_ROUNDS
-	int rounding;
-#endif
+#ifdef Honor_FLT_ROUNDS /*{*/
+	int Rounding;
+#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */
+	Rounding = Flt_Rounds;
+#else /*}{*/
+	Rounding = 1;
+	switch(fegetround()) {
+	  case FE_TOWARDZERO:	Rounding = 0; break;
+	  case FE_UPWARD:	Rounding = 2; break;
+	  case FE_DOWNWARD:	Rounding = 3;
+	  }
+#endif /*}}*/
+#endif /*}*/
 
 	sign = nz0 = nz = decpt = 0;
 	dval(rv) = 0.;
@@ -109,7 +118,7 @@
 		}
  break2:
 	if (*s == '0') {
-#ifndef NO_HEX_FP
+#ifndef NO_HEX_FP /*{{*/
 		{
 		static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI };
 		Long exp;
@@ -118,16 +127,20 @@
 		  case 'x':
 		  case 'X':
 			{
-#if defined(FE_DOWNWARD) && defined(FE_TONEAREST) && defined(FE_TOWARDZERO) && defined(FE_UPWARD)
+#if defined(FE_DOWNWARD) && defined(FE_TONEAREST) && defined(FE_TOWARDZERO) && defined(FE_UPWARD) /*{{*/
 			FPI fpi1 = fpi;
+#ifdef Honor_FLT_ROUNDS /*{{*/
+			fpi1.rounding = Rounding;
+#else /*}{*/
 			switch(fegetround()) {
 			  case FE_TOWARDZERO:	fpi1.rounding = 0; break;
 			  case FE_UPWARD:	fpi1.rounding = 2; break;
 			  case FE_DOWNWARD:	fpi1.rounding = 3;
 			  }
-#else
+#endif /*}}*/
+#else /*}{*/
 #define fpi1 fpi
-#endif
+#endif /*}}*/
 			switch((i = gethex(&s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) {
 			  case STRTOG_NoNumber:
 				s = s00;
@@ -381,12 +394,12 @@
 	scale = 0;
 #endif
 #ifdef Honor_FLT_ROUNDS
-	if ((rounding = Flt_Rounds) >= 2) {
+	if (Rounding >= 2) {
 		if (sign)
-			rounding = rounding == 2 ? 0 : 2;
+			Rounding = Rounding == 2 ? 0 : 2;
 		else
-			if (rounding != 2)
-				rounding = 0;
+			if (Rounding != 2)
+				Rounding = 0;
 		}
 #endif
 #endif /*IEEE_Arith*/
@@ -405,7 +418,7 @@
 				/* Can't trust HUGE_VAL */
 #ifdef IEEE_Arith
 #ifdef Honor_FLT_ROUNDS
-				switch(rounding) {
+				switch(Rounding) {
 				  case 0: /* toward 0 */
 				  case 3: /* toward -infinity */
 					word0(rv) = Big0;
@@ -536,7 +549,7 @@
 			bd2 -= bbe;
 		bs2 = bb2;
 #ifdef Honor_FLT_ROUNDS
-		if (rounding != 1)
+		if (Rounding != 1)
 			bs2++;
 #endif
 #ifdef Avoid_Underflow
@@ -594,7 +607,7 @@
 		delta->sign = 0;
 		i = cmp(delta, bs);
 #ifdef Honor_FLT_ROUNDS
-		if (rounding != 1) {
+		if (Rounding != 1) {
 			if (i < 0) {
 				/* Error is less than an ulp */
 				if (!delta->x[0] && delta->wds <= 1) {
@@ -604,7 +617,7 @@
 #endif
 					break;
 					}
-				if (rounding) {
+				if (Rounding) {
 					if (dsign) {
 						adj = 1.;
 						goto apply_adj;
@@ -650,10 +663,10 @@
 			if (adj < 1.)
 				adj = 1.;
 			if (adj <= 0x7ffffffe) {
-				/* adj = rounding ? ceil(adj) : floor(adj); */
+				/* adj = Rounding ? ceil(adj) : floor(adj); */
 				y = adj;
 				if (y != adj) {
-					if (!((rounding>>1) ^ dsign))
+					if (!((Rounding>>1) ^ dsign))
 						y++;
 					adj = y;
 					}
@@ -676,8 +689,11 @@
 #endif /*Sudden_Underflow*/
 #endif /*Avoid_Underflow*/
 			adj *= ulp(dval(rv));
-			if (dsign)
+			if (dsign) {
+				if (word0(rv) == Big0 && word1(rv) == Big1)
+					goto ovfl;
 				dval(rv) += adj;
+				}
 			else
 				dval(rv) -= adj;
 			goto cont;
@@ -770,7 +786,7 @@
 					}
 #endif /*Avoid_Underflow*/
 				L = (word0(rv) & Exp_mask) - Exp_msk1;
-#endif /*Sudden_Underflow}*/
+#endif /*Sudden_Underflow}}*/
 				word0(rv) = L | Bndry_mask1;
 				word1(rv) = 0xffffffff;
 #ifdef IBM

==== //depot/projects/mpsafetty/contrib/gdtoa/strtodg.c#2 (text+ko) ====

@@ -89,7 +89,7 @@
 	return b;
 	}
 
- int
+ void
 #ifdef KR_headers
 decrement(b) Bigint *b;
 #else
@@ -119,7 +119,6 @@
 		*x++ = y & 0xffff;
 		} while(borrow && x < xe);
 #endif
-	return STRTOG_Inexlo;
 	}
 
  static int
@@ -206,9 +205,9 @@
 		goto ret;
 		}
 	switch(rd) {
-	  case 1:
+	  case 1: /* round down (toward -Infinity) */
 		goto trunc;
-	  case 2:
+	  case 2: /* round up (toward +Infinity) */
 		break;
 	  default: /* round near */
 		k = bdif - 1;
@@ -330,7 +329,7 @@
 	CONST char *s, *s0, *s1;
 	double adj, adj0, rv, tol;
 	Long L;
-	ULong y, z;
+	ULong *b, *be, y, z;
 	Bigint *ab, *bb, *bb1, *bd, *bd0, *bs, *delta, *rvb, *rvb0;
 
 	irv = STRTOG_Zero;
@@ -822,10 +821,8 @@
 				break;
 			if (dsign) {
 				rvb = increment(rvb);
-				if ( (j = rvbits & kmask) !=0)
-					j = ULbits - j;
-				if (hi0bits(rvb->x[(rvb->wds - 1) >> kshift])
-						!= j)
+				j = kmask & (ULbits - (rvbits & kmask));
+				if (hi0bits(rvb->x[rvb->wds - 1]) != j)
 					rvbits++;
 				irv = STRTOG_Normal | STRTOG_Inexhi;
 				}
@@ -978,6 +975,29 @@
 	Bfree(bd0);
 	Bfree(delta);
 	if (rve > fpi->emax) {
+		switch(fpi->rounding & 3) {
+		  case FPI_Round_near:
+			goto huge;
+		  case FPI_Round_up:
+			if (!sign)
+				goto huge;
+			break;
+		  case FPI_Round_down:
+			if (sign)
+				goto huge;
+		  }
+		/* Round to largest representable magnitude */
+		Bfree(rvb);
+		rvb = 0;
+		irv = STRTOG_Normal | STRTOG_Inexlo;
+		*exp = fpi->emax;
+		b = bits;
+		be = b + (fpi->nbits >> 5) + 1;
+		while(b < be)
+			*b++ = -1;
+		if ((j = fpi->nbits & 0x1f))
+			*--be >>= (32 - j);
+		goto ret;
  huge:
 		rvb->wds = 0;
 		irv = STRTOG_Infinite | STRTOG_Overflow | STRTOG_Inexhi;
@@ -992,12 +1012,19 @@
 		if (sudden_underflow) {
 			rvb->wds = 0;
 			irv = STRTOG_Underflow | STRTOG_Inexlo;
+#ifndef NO_ERRNO
+			errno = ERANGE;
+#endif
 			}
 		else  {
 			irv = (irv & ~STRTOG_Retmask) |
 				(rvb->wds > 0 ? STRTOG_Denormal : STRTOG_Zero);
-			if (irv & STRTOG_Inexact)
+			if (irv & STRTOG_Inexact) {
 				irv |= STRTOG_Underflow;
+#ifndef NO_ERRNO
+				errno = ERANGE;
+#endif
+				}
 			}
 		}
 	if (se)

==== //depot/projects/mpsafetty/contrib/gdtoa/strtof.c#2 (text+ko) ====

@@ -29,7 +29,7 @@
 /* Please send bug reports to David M. Gay (dmg at acm dot org,
  * with " at " changed at "@" and " dot " changed to ".").	*/
 
-/* $FreeBSD: src/contrib/gdtoa/strtof.c,v 1.2 2007/12/16 21:14:33 das Exp $ */
+/* $FreeBSD: src/contrib/gdtoa/strtof.c,v 1.3 2008/09/03 07:32:06 das Exp $ */
 
 #include "gdtoaimp.h"
 
@@ -40,13 +40,21 @@
 strtof(CONST char *s, char **sp)
 #endif
 {
-	static FPI fpi = { 24, 1-127-24+1,  254-127-24+1, 1, SI };
+	static FPI fpi0 = { 24, 1-127-24+1,  254-127-24+1, 1, SI };
+	FPI *fpi, fpi1;
 	ULong bits[1];
 	Long exp;
 	int k;
+	int Rounding = Flt_Rounds;
 	union { ULong L[1]; float f; } u;
 
-	k = strtodg(s, sp, &fpi, &exp, bits);
+	fpi = &fpi0;
+	if (Rounding != FPI_Round_near) {
+		fpi1 = fpi0;
+		fpi1.rounding = Rounding;
+		fpi = &fpi1;
+		}
+	k = strtodg(s, sp, fpi, &exp, bits);
 	switch(k & STRTOG_Retmask) {
 	  case STRTOG_NoNumber:
 	  case STRTOG_Zero:

==== //depot/projects/mpsafetty/contrib/gdtoa/test/README#2 (text+ko) ====

@@ -55,7 +55,12 @@
 
 Program strtodt tests strtod on some hard cases (in file testnos3)
 posted by Fred Tydeman to comp.arch.arithmetic on 26 Feb. 1996.
+To get correct results on Intel (x86) systems, the rounding precision
+must be set to 53 bits.  This can be done, e.g., by invoking
+fpinit_ASL(), whose source appears in
+http://www.netlib.org/ampl/solvers/fpinit.c .
 
 These are simple test programs, not meant for exhaustive testing,
 but for manually testing "interesting" cases.  Paxson's testbase
 is good for more exhaustive testing, in part with random inputs.
+See ftp://ftp.ee.lbl.gov/testbase-report.ps.Z .

==== //depot/projects/mpsafetty/contrib/gdtoa/test/f.out#2 (text+ko) ====

@@ -124,7 +124,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 9 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 
 Input: 1.23e-320
@@ -132,7 +134,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 9 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 
 Input: 1.23e-20
@@ -160,7 +164,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 15 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 
 Input: 1.234567890123456789
@@ -188,7 +194,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 25 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 
 Input: 1.234567890123456789e-321
@@ -196,7 +204,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 25 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 
 Input: 1e23
@@ -224,7 +234,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 23 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 
 Input: 9.025971879324147880346310405869e-277
@@ -232,7 +244,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 37 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 
 Input: 9.025971879324147880346310405868e-277
@@ -240,7 +254,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 37 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 
 Input: 2.2250738585072014e-308
@@ -248,7 +264,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 23 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 
 Input: 2.2250738585072013e-308
@@ -256,7 +274,9 @@
 g_ffmt(0) gives 1 bytes: "0"
 
 strtoIf returns 80, consuming 23 bytes.
-fI[0] == fI[1] == strtof
+fI[0] = #0 = 0
+fI[1] = #1 = 1.4012985e-45
+fI[0] == strtof
 
 Rounding mode for strtor... changed from 1 (nearest) to 0 (toward zero)
 

==== //depot/projects/mpsafetty/contrib/gdtoa/test/getround.c#2 (text+ko) ====

@@ -44,7 +44,14 @@
 {
 	int i;
 
-	i = atoi(s+1);
+	while(*++s <= ' ') {
+		if (!*s) {
+			printf("Current round mode for strtor... is %d (%s).\n",
+				r, dir[r]);
+			return r;
+			}
+		}	
+	i = atoi(s);
 	if (i >= 0 && i < 4) {
 		printf("Rounding mode for strtor... ");
 		if (i == r)

==== //depot/projects/mpsafetty/contrib/gdtoa/test/xsum0.out#2 (text+ko) ====

@@ -1,11 +1,11 @@
-README	e6ebdc91	2429
+README	e86e9133	2692
 Qtest.c	e8353ffc	5046

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809041717.m84HH4hr076312>