note 2597 modified in round by jeroen
| From: | jeroen@php.net | Date: | Wed, 23 May 2001 23:21:47 +0000 |
| Subject: | note 2597 modified in round by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14222@lists.php.net to get a copy of this message | ||
[Editor's note: Proving can't be done with any finite set of tests... show me an inductive
proof, and I'll believe you!]
The following proves this is "banker's" rounding. So - rounding anything that's
exactly x.5 will result in a a round number being returned.
$i=1;
while ($i<100) {
$halfs = $i/2;
$roundedhalf = round($halfs);
if ($rounded
print ("$halfs rounds to $rounded<br>");
$i++;
}
http://www.php.net/manual/round.php