php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #25802 User Notes inaccurate
Submitted: 2003-10-09 05:34 UTC Modified: 2003-10-09 05:59 UTC
From: wonglow at yahoo dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 - 22 = ?
Subscribe to this entry?

 
 [2003-10-09 05:34 UTC] wonglow at yahoo dot com
Description:
------------
A note added at "http://www.php.net/manual/en/function.round.php" is inaccurate

limit0.com
17-Aug-2003 09:58 
Here is how to always round up...
$x = (a/b);
$r = round($x);
$d = ($x-$r);

if ($d>0){
$x = ($r+1);
}
.....


The result above will not always round up variable $x.
e.g If $x=0.6777
then $r = 1 and $d = -0.3223
Since $d < 0
$x is still 0.6777. It never round up ,except if $x < 0.5. 
I believe ceil() is doing a good job.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-09 05:59 UTC] didou@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.

see #25801
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 11:01:29 2024 UTC