note 110348 deleted from function.round by danbrown
| From: | danbrown@php.net | Date: | Wed, 17 Oct 2012 21:20:49 +0000 |
| Subject: | note 110348 deleted from function.round by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191377@lists.php.net to get a copy of this message | ||
Note Submitter: espertalhao04 at hotmail dot com
----
using the code given below:
<?php
$decimals = 1;
$n=5.95;
echo "<br>n=",$n," ==> ",round($n, $decimals); // 5.95 ==> 6 !
$n = ( 11.9 ) / 2;
echo "<br>n=",$n," ==> ",round($n, $decimals); // 5.95 ==> 6 !
$n = ( 2.7 + 9.2 ) / 2;
echo "<br>n=",$n," ==> ",round($n, $decimals); // 5.95 ==> 5.9 ??
?>
results on php 5.2.15:
n=5.95 ==> 6
n=5.95 ==> 6
n=5.95 ==> 6
on php 5.1.6:
n=5.95 ==> 6
n=5.95 ==> 6
n=5.95 ==> 5.9
tested on:
http://sandbox.onlinephpfunctions.com/