note 89875 deleted from function.bcscale by danbrown
| From: | danbrown@php.net | Date: | Thu, 26 Mar 2009 19:54:50 +0000 |
| Subject: | note 89875 deleted from function.bcscale by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152494@lists.php.net to get a copy of this message | ||
Note Submitter: morte at barklund dot dk
----
The below-mentioned zero-removing-funtion is quite superfluous, as rtrim($num, "0.") does
the exact same thing:
<?php
bcscale(10);
$res= bcdiv(10,8);
printf("result = %s, %s\n", $res, rtrim($res,"0."));
// result = 1.2500000000, 1.25
$res= bcdiv(10,5);
printf("result = %s, %s\n", $res, rtrim($res,"0."));
// result = 2.0000000000, 2
?>
No need to reinvent the corkscrew :)
Barklund