iliaa Fri, 19 Nov 2010 16:36:10 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=305561
Log: Fixed bug #47168 (printf of floating point variable prints maximum of 40 decimal places). Bug: http://bugs.php.net/47168 (Assigned) printf of floating point variable prints maximum of 40 decimal places Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/standard/formatted_print.c A php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug47168.phpt U php/php-src/trunk/ext/standard/formatted_print.c A php/php-src/trunk/ext/standard/tests/strings/bug47168.phpt Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2010-11-19 16:03:00 UTC (rev 305560) +++ php/php-src/branches/PHP_5_3/NEWS 2010-11-19 16:36:10 UTC (rev 305561) @@ -1,6 +1,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2010, PHP 5.3.4 +- Fixed bug #47168 (printf of floating point variable prints maximum of 40 + decimal places). (Ilia) 18 Nov 2010, PHP 5.3.4RC1 - Upgraded bundled Sqlite3 to version 3.7.3. (Ilia) Modified: php/php-src/branches/PHP_5_3/ext/standard/formatted_print.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/formatted_print.c 2010-11-19 16:03:00 UTC (rev 305560) +++ php/php-src/branches/PHP_5_3/ext/standard/formatted_print.c 2010-11-19 16:36:10 UTC (rev 305561) @@ -41,7 +41,7 @@ #define FLOAT_DIGITS 6 #define FLOAT_PRECISION 6 #define MAX_FLOAT_DIGITS 38 -#define MAX_FLOAT_PRECISION 40 +#define MAX_FLOAT_PRECISION 53 #if 0 /* trick to control varargs functions through cpp */ Added: php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug47168.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug47168.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug47168.phpt 2010-11-19 16:36:10 UTC (rev 305561) @@ -0,0 +1,12 @@ +--TEST-- +Bug #47168 (printf of floating point variable prints maximum of 40 decimal places) +--FILE-- +<?php + +$dyadic = 0.00000000000045474735088646411895751953125; +var_dump(printf ("%1.41f\n",unserialize(serialize($dyadic)))); + +?> +--EXPECT-- +0.00000000000045474735088646411895751953125 +int(44) Modified: php/php-src/trunk/ext/standard/formatted_print.c =================================================================== --- php/php-src/trunk/ext/standard/formatted_print.c 2010-11-19 16:03:00 UTC (rev 305560) +++ php/php-src/trunk/ext/standard/formatted_print.c 2010-11-19 16:36:10 UTC (rev 305561) @@ -41,7 +41,7 @@ #define FLOAT_DIGITS 6 #define FLOAT_PRECISION 6 #define MAX_FLOAT_DIGITS 38 -#define MAX_FLOAT_PRECISION 40 +#define MAX_FLOAT_PRECISION 53 #if 0 /* trick to control varargs functions through cpp */ Added: php/php-src/trunk/ext/standard/tests/strings/bug47168.phpt =================================================================== --- php/php-src/trunk/ext/standard/tests/strings/bug47168.phpt (rev 0) +++ php/php-src/trunk/ext/standard/tests/strings/bug47168.phpt 2010-11-19 16:36:10 UTC (rev 305561) @@ -0,0 +1,12 @@ +--TEST-- +Bug #47168 (printf of floating point variable prints maximum of 40 decimal places) +--FILE-- +<?php + +$dyadic = 0.00000000000045474735088646411895751953125; +var_dump(printf ("%1.41f\n",unserialize(serialize($dyadic)))); + +?> +--EXPECT-- +0.00000000000045474735088646411895751953125 +int(44)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php