RE: RE: round()

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

 





tedd wrote:
> 
> At 7:30 PM -0700 10/11/07, Instruct ICC wrote:
>>
>>
>>Now I see why BCMath was mentioned.
> 
> Yes, but precision is not the issue.
> 
> It doesn't make any difference if you are rounding.
> 
> (a) 1.489123451985765
> 
> or
> 
> (b) 148912345198576.5
> 
> You still have to make a decision as to if the above (a) rounds to:
> 
> (a) 1.48912345198577
> 
> or
> 
> (a) 1.48912345198576
> 
> or the above (b) rounds to:
> 
> (b)148912345198577
> 
> or
> 
> (b) 148912345198576
> 
> It's a question of rounding, not precision.
> 
> Cheers,
> 
> tedd
> 
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

It's a question of what you expect from a rounding function. 
If you work with reals on a computer you always have a bit of "fuzzynes" 
due to the internal conversions from float to binary and resulting
truncations.
If you need reproducable results which fit your expectations and if speed 
doesn't matter just use your own routine depending on string comparison.

YMMV
-- 
View this message in context: http://www.nabble.com/round%28%29-tf4602528.html#a13177072
Sent from the PHP - General mailing list archive at Nabble.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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