cvs: ZendEngine2(PHP_5_2) / zend_strtod.c /tests bug43053.phpt hex_overflow_32bit.phpt zend_strtod.phpt php-src NEWS php-src/ext/standard/tests/general_functions 008.phpt php-src/ext/standard/tests/strings printf.phpt php-src/main snprintf.c

[email protected] ("Dmitry Stogov")
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1221479223@cvsserver>
dmitry		Mon Sep 15 11:47:03 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /ZendEngine2/tests	bug43053.phpt 

  Modified files:              
    /php-src	NEWS 
    /php-src/ext/standard/tests/general_functions	008.phpt 
    /php-src/ext/standard/tests/strings	printf.phpt 
    /php-src/main	snprintf.c 
    /ZendEngine2	zend_strtod.c 
    /ZendEngine2/tests	hex_overflow_32bit.phpt zend_strtod.phpt 
  Log:
  Fixed bug #43053 (Regression: some numbers shown in scientific notation). (int-e at gmx dot de)
  some 64bit test files may need to be fixed
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1226&r2=1.2027.2.547.2.1227&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1226 php-src/NEWS:1.2027.2.547.2.1227
--- php-src/NEWS:1.2027.2.547.2.1226	Sun Sep 14 05:15:14 2008
+++ php-src/NEWS	Mon Sep 15 11:47:02 2008
@@ -116,6 +116,8 @@
 - Fixed bug #43666 (Fixed code to use ODBC 3.52 datatypes for 64bit systems). 
   (Patrick)
 - Fixed bug #43540 (rfc1867 handler newlength problem). (Arnaud)
+- Fixed bug #43053 (Regression: some numbers shown in scientific notation).
+  (int-e at gmx dot de)
 - Fixed bug #42737 (preg_split('//u') triggers a E_NOTICE with newlines).
   (Nuno)
 - Fixed bug #42604 ("make test" fails with --with-config-file-scan-dir=path).
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/008.phpt?r1=1.2&r2=1.2.6.1&diff_format=u
Index: php-src/ext/standard/tests/general_functions/008.phpt
diff -u php-src/ext/standard/tests/general_functions/008.phpt:1.2 php-src/ext/standard/tests/general_functions/008.phpt:1.2.6.1
--- php-src/ext/standard/tests/general_functions/008.phpt:1.2	Sat Nov 16 23:45:58 2002
+++ php-src/ext/standard/tests/general_functions/008.phpt	Mon Sep 15 11:47:03 2008
@@ -34,7 +34,7 @@
   [11]=>
   float(123456789012)
   [12]=>
-  float(1234567890120)
+  float(1.23456789012E+12)
   [13]=>
   float(1.23456789012E+19)
 }
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/printf.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
Index: php-src/ext/standard/tests/strings/printf.phpt
diff -u php-src/ext/standard/tests/strings/printf.phpt:1.1.2.3 php-src/ext/standard/tests/strings/printf.phpt:1.1.2.4
--- php-src/ext/standard/tests/strings/printf.phpt:1.1.2.3	Thu Apr 26 23:30:00 2007
+++ php-src/ext/standard/tests/strings/printf.phpt	Mon Sep 15 11:47:03 2008
@@ -645,10 +645,10 @@
 -123456
 123456
 -123456
-120000
--120000
-+120000
--120000
+1.2e+5
+-1.2e+5
++1.2e+5
+-1.2e+5
 123456
 -123456
 1.0E+5
@@ -657,10 +657,10 @@
 -123456
 123456
 -123456
-120000
--120000
-+120000
--120000
+1.2E+5
+-1.2E+5
++1.2E+5
+-1.2E+5
 
 *** Output for '%%%.2f' as the format parameter ***
 %12345678900.00
http://cvs.php.net/viewvc.cgi/php-src/main/snprintf.c?r1=1.37.2.4.2.16&r2=1.37.2.4.2.17&diff_format=u
Index: php-src/main/snprintf.c
diff -u php-src/main/snprintf.c:1.37.2.4.2.16 php-src/main/snprintf.c:1.37.2.4.2.17
--- php-src/main/snprintf.c:1.37.2.4.2.16	Mon Dec 31 07:20:15 2007
+++ php-src/main/snprintf.c	Mon Sep 15 11:47:03 2008
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: snprintf.c,v 1.37.2.4.2.16 2007/12/31 07:20:15 sebastian Exp $ */
+/* $Id: snprintf.c,v 1.37.2.4.2.17 2008/09/15 11:47:03 dmitry Exp $ */
 
 
 #include "php.h"
@@ -155,10 +155,7 @@
 		*dst++ = '-';
 	}
 
-	for (i = 0; i < ndigit && digits[i] != '\0'; i++);
-	
-	if ((decpt >= 0 && decpt - i > 4)
-			|| (decpt < 0 && decpt < -3)) {     /* use E-style */
+	if ((decpt >= 0 && decpt > ndigit) || decpt < -3) { /* use E-style */
 		/* exponential format (e.g. 1.2345e+13) */
 		if (--decpt < 0) {
 			sign = 1;
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_strtod.c?r1=1.17.2.2.2.14&r2=1.17.2.2.2.15&diff_format=u
Index: ZendEngine2/zend_strtod.c
diff -u ZendEngine2/zend_strtod.c:1.17.2.2.2.14 ZendEngine2/zend_strtod.c:1.17.2.2.2.15
--- ZendEngine2/zend_strtod.c:1.17.2.2.2.14	Sun Jul 27 11:28:53 2008
+++ ZendEngine2/zend_strtod.c	Mon Sep 15 11:47:03 2008
@@ -89,7 +89,7 @@
  *	directly -- and assumed always to succeed.
  */
 
-/* $Id: zend_strtod.c,v 1.17.2.2.2.14 2008/07/27 11:28:53 dmitry Exp $ */
+/* $Id: zend_strtod.c,v 1.17.2.2.2.15 2008/09/15 11:47:03 dmitry Exp $ */
 
 #include <zend_operators.h>
 #include <zend_strtod.h>
@@ -1720,14 +1720,7 @@
 					if (value(d) > 0.5 + value(eps))
 						goto bump_up;
 					else if (value(d) < 0.5 - value(eps)) {
-						/* cut ALL traling zeros only if the number of chars is greater than precision 
-						 * otherwise cut only extra zeros
-						 */
-						if (k < ndigits) {
-							while(*--s == '0' && (s - s0) > k);
-						} else {
-							while(*--s == '0');
-						}
+						while(*--s == '0');
 						s++;
 						goto ret1;
 					}
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/hex_overflow_32bit.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
Index: ZendEngine2/tests/hex_overflow_32bit.phpt
diff -u ZendEngine2/tests/hex_overflow_32bit.phpt:1.1.2.3 ZendEngine2/tests/hex_overflow_32bit.phpt:1.1.2.4
--- ZendEngine2/tests/hex_overflow_32bit.phpt:1.1.2.3	Thu Apr 26 23:29:34 2007
+++ ZendEngine2/tests/hex_overflow_32bit.phpt	Mon Sep 15 11:47:03 2008
@@ -22,7 +22,7 @@
 echo "Done\n";
 ?>
 --EXPECTF--	
-float(4083360297110%d)
+float(4.0833602971%dE+14)
 float(4.7223664828%dE+21)
 float(1.3521606402%dE+31)
 float(1.9807040628%dE+27)
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/zend_strtod.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&diff_format=u
Index: ZendEngine2/tests/zend_strtod.phpt
diff -u ZendEngine2/tests/zend_strtod.phpt:1.1.2.2 ZendEngine2/tests/zend_strtod.phpt:1.1.2.2.2.1
--- ZendEngine2/tests/zend_strtod.phpt:1.1.2.2	Wed Mar  1 17:19:22 2006
+++ ZendEngine2/tests/zend_strtod.phpt	Mon Sep 15 11:47:03 2008
@@ -15,5 +15,5 @@
 float(-100)
 float(808792757210)
 float(-4.5646456464565E+27)
-float(-11276204760067000)
+float(-1.1276204760067E+16)
 Done

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug43053.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug43053.phpt
+++ ZendEngine2/tests/bug43053.phpt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.