note 55369 added to function.number-format
| From: | astrolox at lawyersonline dot co dot uk | Date: | Mon, 01 Aug 2005 15:34:57 +0000 |
| Subject: | note 55369 added to function.number-format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92875@lists.php.net to get a copy of this message | ||
Users should be aware of the following behaviour.
I'm not sure if this is a PHP bug, libc bug, or if it's even a bug at all. So I thought
I'd make a comment and allow everyone else to make up their own minds.
FreeBSD 4.3 PHP 4.3.3
<?php
// the comments show the output generated by this script
echo "input 8.525 output = ". number_format( 8.525, 2, '.', "")
."\n";
echo "input 8.525 output = ". number_format(8.525, 2, '.', "")
."\n";
// input 8.525 output = 8.53
// input 8.525 output = 8.53
$a = 483.00;
$b = 0.175;
$c = $a * $b;
echo "input \$c = $c type ". gettype($c) ." output = ". number_format( $c, 2,
'.', "") ."\n";
// input $c = 84.525 type double output = 84.52
$d = 17.5;
$e = ( $a / 100 ) * $d;
echo "input \$e = $e type ". gettype($e) ." output = ". number_format( $e, 2,
'.', "") ."\n";
// input $e = 84.525 type double output = 84.53
echo "input 63.745 output = ". number_format(63.745, 2, '.', "")
."\n";
echo "input 64.745 output = ". number_format(64.745, 2, '.', "")
."\n";
echo "input 65.745 output = ". number_format(65.745, 2, '.', "")
."\n";
// input 63.745 output = 63.74
// input 64.745 output = 64.75
// input 65.745 output = 65.75
?>
----
Submitter IP: 85.116.5.111
----
Manual Page -- http://www.php.net/manual/en/function.number-format.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55369
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55369&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55369&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55369&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55369&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55369&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55369&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55369&report=yes
Search -- http://master.php.net/manage/user-notes.php