Bug #14402 Updated: round() outputs too many digits
| From: | lobbin@php.net | Date: | Wed, 02 Jan 2002 19:06:32 +0000 |
| Subject: | Bug #14402 Updated: round() outputs too many digits | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-75657@lists.php.net to get a copy of this message | ||
ID: 14402
Updated by: lobbin
Reported By: michiel@parse.nl
Old Status: Feedback
Status: Closed
Bug Type: Math related
Operating System: Linux-2.4.14 (Slackware 8.0)
PHP Version: 4.1.0RC5
New Comment:
No feedback. Closing.
Previous Comments:
------------------------------------------------------------------------
[2001-12-12 11:30:26] sniper@php.net
can't reproduce either with PHP 4.2.0-dev.
Try the latest CVS snapshot: http://snaps.php.net/
--Jani
------------------------------------------------------------------------
[2001-12-11 16:16:45] derick@php.net
weird, this works fine for me (PHP cgi).
Derick
------------------------------------------------------------------------
[2001-12-10 09:51:40] michiel@parse.nl
Changed distro/php version for clarity.
------------------------------------------------------------------------
[2001-12-10 09:47:24] michiel@parse.nl
<?
$int = 0.293847289472983;
echo $int ."\n";
echo round($int,2) . "\n";
echo round((int)$int,2) . "\n";
echo round((float)$int,2) . "\n";
echo round((double)$int,2) . "\n";
?>
outputs on php 4.0.6:
0.29384728947298
0.29
0
0.29
0.29
however, using php 4.1.0, it outputs:
0.29384728947298299761570206101168878376483917236328125
0.289999999999999980015985556747182272374629974365234375
0
0.289999999999999980015985556747182272374629974365234375
0.289999999999999980015985556747182272374629974365234375
is this a bug, or a new 'feature' ? Closest report I found was http://marc.theaimsgroup.com/?l=php-dev&m=100750316722784&w=2
on the php-dev mailinglist.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14402&edit=1