|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-12 00:06 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
Description: ------------ When using the format '%(n' (i.e. represent negative numbers in parenthesis), money_format still prints out a negative sign when its second parameter is 0.00*-1. It works fine for the following values, however: -0.00 -0 0*-1 -1*0 -1*0.00 -1.00*0 (Note: echo(0.00*-1) prints out -0.) Interestingly, using gcc-3.3.4 and glibc-2.3.2, the following fails in a similar fashion: strfmon(buf, sizeof(buf), "%(n", atof("-0.00")); /* buf = "-0.00" */ double val = 0.00 * -1; strfmon(buf, sizeof(buf), "%(n", val); /* buf = "-0.00" */ double val = -1*0.00; strfmon(buf, sizeof(buf), "%(n", val); /* buf = "-0.00" */ It appears it might have something to do with strfmon()'s handling of 'negative zero', except money_format() works correctly for values where strfmon() fails (e.g. -1*0.00). Reproduce code: --------------- echo money_format("%(n", 0.00*-1) . "\n"; Expected result: ---------------- 0.00 or even (0.00) Actual result: -------------- -0.00