php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30462 round() error
Submitted: 2004-10-17 04:14 UTC Modified: 2005-09-22 21:38 UTC
From: haafiz at ezwebsolutions dot ca Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.3.8 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: haafiz at ezwebsolutions dot ca
New email:
PHP Version: OS:

 

 [2004-10-17 04:14 UTC] haafiz at ezwebsolutions dot ca
Description:
------------
two variable, $x[$g] and $y[$g]...

serialize($x[$g]) returns:  i:34;
serialize($y[$g]) returns:  i:43;

but
serialize(round($x[$g]/$y[$g], 5)) returns: d:0.7907000000000000028421709430404007434844970703125;


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-17 20:29 UTC] haafiz at ezwebsolutions dot ca
<?php

$g = 0;
$x[$g] = 34;
$y[$g] = 43;

echo serialize(round($x[$g]/$y[$g], 5));

?>

Output:
d:0.7907000000000000028421709430404007434844970703125;
 [2004-10-18 23:53 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

check the serialize precision option.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC