Re: Numeric help needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 1/15/2012 9:24 PM, Robert Williams wrote:
On Jan 15, 2012, at 19:00, "Simon J Welsh"<simon@xxxxxxxxxxx<mailto:simon@xxxxxxxxxxx>>  wrote:

On 16/01/2012, at 2:48 PM, Chris Payne wrote:

"If the loan amount is $68500.00, the insurace will be based on
$69000.00 as the amount is always rounded up to the next $1000."

The round() function only rounds decimal values. You can use this to emulate rounding to a near power of ten by dividing, rounding, then multiplying again. i.e. echo "<br>" . round(68500/1000) * 1000 . " ROUNDED";

round() rounds floating point which I suppose includes decimals, but decimal tends to have a fixed number of decimal places.


float *round* ( float $val [, int $precision= 0 [, int $mode= PHP_ROUND_HALF_UP ]] )



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux