cvs: ZendEngine2 / zend_strtod.c /tests bug43053.phpt hex_overflow_32bit.phpt zend_strtod.phpt 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 <cvsdmitry1221479247@cvsserver>
dmitry		Mon Sep 15 11:47:27 2008 UTC

  Modified files:              
    /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	bug43053.phpt 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/ext/standard/tests/general_functions/008.phpt?r1=1.4&r2=1.5&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.4 php-src/ext/standard/tests/general_functions/008.phpt:1.5
--- php-src/ext/standard/tests/general_functions/008.phpt:1.4	Tue May 27 00:04:31 2008
+++ php-src/ext/standard/tests/general_functions/008.phpt	Mon Sep 15 11:47:27 2008
@@ -34,7 +34,7 @@
   [11]=>
   float(123456789012)
   [12]=>
-  float(1234567890120)
+  float(1.23456789012E+12)
   [13]=>
   float(1.23456789012E+19)
 }
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/printf.phpt?r1=1.6&r2=1.7&diff_format=u
Index: php-src/ext/standard/tests/strings/printf.phpt
diff -u php-src/ext/standard/tests/strings/printf.phpt:1.6 php-src/ext/standard/tests/strings/printf.phpt:1.7
--- php-src/ext/standard/tests/strings/printf.phpt:1.6	Sun Aug 10 21:48:22 2008
+++ php-src/ext/standard/tests/strings/printf.phpt	Mon Sep 15 11:47:27 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.63&r2=1.64&diff_format=u
Index: php-src/main/snprintf.c
diff -u php-src/main/snprintf.c:1.63 php-src/main/snprintf.c:1.64
--- php-src/main/snprintf.c:1.63	Thu Feb  7 18:40:29 2008
+++ php-src/main/snprintf.c	Mon Sep 15 11:47:27 2008
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: snprintf.c,v 1.63 2008/02/07 18:40:29 helly Exp $ */
+/* $Id: snprintf.c,v 1.64 2008/09/15 11:47:27 dmitry Exp $ */
 
 
 #include "php.h"
@@ -152,9 +152,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.38&r2=1.39&diff_format=u
Index: ZendEngine2/zend_strtod.c
diff -u ZendEngine2/zend_strtod.c:1.38 ZendEngine2/zend_strtod.c:1.39
--- ZendEngine2/zend_strtod.c:1.38	Sun Jul 27 11:29:59 2008
+++ ZendEngine2/zend_strtod.c	Mon Sep 15 11:47:27 2008
@@ -89,7 +89,7 @@
  *	directly -- and assumed always to succeed.
  */
 
-/* $Id: zend_strtod.c,v 1.38 2008/07/27 11:29:59 dmitry Exp $ */
+/* $Id: zend_strtod.c,v 1.39 2008/09/15 11:47:27 dmitry Exp $ */
 
 #include <zend.h>
 #include <unicode/utypes.h>
@@ -1732,14 +1732,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/bug43053.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug43053.phpt
diff -u /dev/null ZendEngine2/tests/bug43053.phpt:1.2
--- /dev/null	Mon Sep 15 11:47:27 2008
+++ ZendEngine2/tests/bug43053.phpt	Mon Sep 15 11:47:27 2008
@@ -0,0 +1,14 @@
+--TEST--
+Bug #43053 (Regression: some numbers shown in scientific notation)
+--FILE--
+<?php
+echo 1200000.00."\n";
+echo 1300000.00."\n";
+echo 1400000.00."\n";
+echo 1500000.00."\n";
+?>
+--EXPECT--
+1200000
+1300000
+1400000
+1500000
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/hex_overflow_32bit.phpt?r1=1.3&r2=1.4&diff_format=u
Index: ZendEngine2/tests/hex_overflow_32bit.phpt
diff -u ZendEngine2/tests/hex_overflow_32bit.phpt:1.3 ZendEngine2/tests/hex_overflow_32bit.phpt:1.4
--- ZendEngine2/tests/hex_overflow_32bit.phpt:1.3	Mon May 26 14:33:43 2008
+++ ZendEngine2/tests/hex_overflow_32bit.phpt	Mon Sep 15 11:47:27 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.4&r2=1.5&diff_format=u
Index: ZendEngine2/tests/zend_strtod.phpt
diff -u ZendEngine2/tests/zend_strtod.phpt:1.4 ZendEngine2/tests/zend_strtod.phpt:1.5
--- ZendEngine2/tests/zend_strtod.phpt:1.4	Mon May 26 14:33:44 2008
+++ ZendEngine2/tests/zend_strtod.phpt	Mon Sep 15 11:47:27 2008
@@ -15,5 +15,5 @@
 float(-100)
 float(808792757210)
 float(-4.5646456464565E+27)
-float(-11276204760067000)
+float(-1.1276204760067E+16)
 Done
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.