Bug #47418 [Com]: number_format misbehaving with some values

From: Date: Sat, 17 Jul 2010 03:53:42 +0000
Subject: Bug #47418 [Com]: number_format misbehaving with some values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152488@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=47418&edit=1

 ID:               47418
 Comment by:       adrianv at taly dot net
 Reported by:      cu19 at gmx dot de
 Summary:          number_format misbehaving with some values
 Status:           No Feedback
 Type:             Bug
 Package:          *Math Functions
 Operating System: Win7
 PHP Version:      5.3.1

 New Comment:

Code to reproduce this, where lib.php contains the my_number_format
function as described by cu19 at gmx dot de. Numbers are internally
correct, but display incorrectly.

<?php

	include_once("lib.php");

 	echo "== Demo 1 == <BR>";

	$deb = 10.50;
	$crd = 1;
	$tot = 0;

	for ($t=1;$t<=300;$t++) {
		$tot += $deb - $crd;
		echo "$t  $tot";
		echo " >>>> ";
		echo strval($tot);
		echo " >>>> ";
		echo sprintf('%F',$tot);
		echo " >>>> ";
		echo number_format($tot,2);
		echo " >>>> ";
		echo my_number_format($tot,2);
		echo " >>>> ";
		echo "<BR>";
	}
?>


Previous Comments:
------------------------------------------------------------------------
[2010-03-08 03:37:01] tdietsche at comcast dot net

did you ever get my email?

------------------------------------------------------------------------
[2010-02-20 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2010-02-12 23:01:50] tdietsche at comcast dot net

pajoye: I have just sent you an email with an attached zip, please reply
here or to my email to confirm that you received it, thanks.

------------------------------------------------------------------------
[2010-02-12 19:10:55] tdietsche at comcast dot net

Yes, I will do that and email you a link. The information is
confidential so I must first remove people's personal information first
(names etc). Please remove the file when you are done with it.

------------------------------------------------------------------------
[2010-02-12 14:18:15] pajoye@php.net

It could be an encoding issue then (before it gets formatted). Can you
zip the script and the excel file you use and post a link to it here? Or
drop me a mail.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=47418


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=47418&edit=1


Thread (24 messages)

« previous php.bugs (#152488) next »