note 2597 modified in round by ronabop

From: Date: Mon, 21 Aug 2000 06:49:55 +0000
Subject: note 2597 modified in round by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-2840@lists.php.net to get a copy of this message
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. <pre> $i=1; while ($i<100) { $halfs = $i/2; $roundedhalf = round($halfs); if ($rounded print ("$halfs rounds to $rounded<br>"); $i++; } </pre> http://www.php.net/manual/function.round.php

« previous php.notes (#2840) next »