Re: round()
| From: | tedd | Date: | Fri, 12 Oct 2007 14:15:39 +0000 |
| Subject: | Re: round() | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263149@lists.php.net to get a copy of this message | ||
At 10:22 AM -0400 10/11/07, Nathan Nobbe wrote:
On 10/11/07, tedd <<mailto:tedd@sperling.com>tedd@sperling.com> wrote: At 4:18 PM -0600 10/10/07, <<mailto:admin@buskirkgraphics.com>admin@buskirkgraphics.com> wrote:Well, if the results were the same, then both exhibit the same accuracy bias in rounding. However, precision is not the issue. There's a difference between precision and accuracy and I am addressing accuracy. For example, if the answer is 4.5, then 4.4 is more accurate than 4.39999999999, but the later is more precise. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.comI disagree. I will need to see an example where the round() is inaccurate.You may disagree if you wish, but the php function round() is inaccurate by definition -- all *rounding* algorithms are inaccurate. thats why i suggested the bcmath based algorithm, as bcmath supports arbitrary precision. i built a quick test script using the method from the top comment of the bcmath page, and round(). it allows for quick comparisons of the 2 algorithms and tells you if the results are the same. i messed around w/ it a little bit and the results were the same every time.