note 2597 deleted from function.round by jeroen

From: Date: Sat, 01 Sep 2001 12:42:01 +0000
Subject: note 2597 deleted from function.round by jeroen
Groups: php.notes 
Request: Send a blank email to php-notes+get-17506@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++; }

« previous php.notes (#17506) next »