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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Wed Aug 17 17:05:44 2022 UTC