ID: 29185 Updated by: [EMAIL PROTECTED] Reported By: hkh at netnords dot dk -Status: Open +Status: Bogus Bug Type: Strings related Operating System: debian 3.0 - Apache 1.3.26 PHP Version: 4.3.7 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Both PHP 4 and 5 return the same expected output. [-0010.00] [-0001.00] [-0000000.99] [-0000000.99] [-0000000.50] [00000000.00] [00000000.50] [00000000.99] [00000000.99] [00001.00] [00010.00] Previous Comments: ------------------------------------------------------------------------ [2004-07-15 15:11:43] hkh at netnords dot dk Description: ------------ I don't get the expected result from sprintf(), when input are less than [-]1. Tried the same code on a php 5.0.0b3 (windows), where I got the expected result. Maybe its related/oposite to bug #28633 Reproduce code: --------------- $fmt = "%08.2f"; printf("[".$fmt."]<br />", -10); printf("[".$fmt."]<br />", -1); printf("[".$fmt."]<br />", -0.995); printf("[".$fmt."]<br />", -0.99); printf("[".$fmt."]<br />", -0.5); printf("[".$fmt."]<br />", 0); printf("[".$fmt."]<br />", 0.5); printf("[".$fmt."]<br />", 0.99); printf("[".$fmt."]<br />", 0.995); printf("[".$fmt."]<br />", 1); printf("[".$fmt."]<br />", 10); Expected result: ---------------- [-0010.00] [-0001.00] [-0001.00] // Not [-0000.99], should't it round down ? [-0000.99] [-0000.50] [00000.00] [00000.50] [00000.99] [00001.00] // Not [00000.99] , should't it round up ? [00001.00] [00010.00] Actual result: -------------- [-0010.00] [-0001.00] [-0000000.99] [-0000000.99] [-0000000.50] [00000000.00] [00000000.50] [00000000.99] [00000000.99] [00001.00] [00010.00] ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29185&edit=1
