Re: PHP5 sprintf() function borken
| From: | hitek at cox dot net | Date: | Wed, 12 Jan 2005 16:42:04 +0000 |
| Subject: | Re: PHP5 sprintf() function borken | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-206230@lists.php.net to get a copy of this message | ||
I ran your code through 3000 iterations and it always results in 0.09. This is on Suse 9.2, Apache
2.0.52 and php 5.0.3
>
> From: Thomas Munz <thomas@ecommerce.com>
> Date: 2005/01/11 Tue AM 11:10:37 EST
> To: php-general@lists.php.net
> Subject: [PHP] PHP5 sprintf() function borken
>
> Today i think i found an bu in the PHP5 version 5.0.3 ( allready exits also in
> the version 5.0.2 , i try this version also ).
>
> When tryo one of this scripts:
>
> $i_test = "0.085007667542";
> $tm_total = sprintf('%.2f', $i_test);
> echo $tm_total;
>
> $i_test = 0.085007667542;
> $tm_total = sprintf('%.2f', $i_test);
> echo $tm_total;
>
> $i_test = "0.085007667542";
> $tm_total = sprintf('%.2f', floatval($i_test));
> echo $tm_total;
>
>
> i always get an other result. Some time it get a result like that:
>
>
> "-26815615859885220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00"
>
> my friend try it also and have the same problems...
>
> is that a bug in php5?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>