Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


At 08:54 20/07/2013 -0700, Todor Takov wrote:
I have given my reasons in an explanation to a post by Luuk in this present discussion. But I think this is not an overkill, because if we have a significantly long number and we just look at the 3 digits to the right of the comma separator and just drop the rest of the digits to the right of them - we shall be risking to get an incorrect result. The correct way to round the number will be to start at the rightmost available digit and drop one digit at a time, until we reach the desired digit position. At least this is correct in my opinion.

Paradoxically, this is certainly not the way that rounding - even banker's rounding - is normally achieved.

You would round 1.23456 to 1.2346 and then to 1.235 and 1.24 (using either scheme). Single rounding (again using either scheme) gives 1.23. This makes sense, since the original number is clearly closer to 1.23 than to 1.24.

It is a general principle that you should always round numbers once; if you do so repeatedly, you will indeed get different results. http://en.wikipedia.org/wiki/Rounding#Double_rounding says:
In _Martinez v. Allstate_ and _Sendejo v. Farmers_, litigated between 1995 and 1997, the insurance companies argued that double rounding premiums was permissible and in fact required. The US courts ruled against the insurance companies and ordered them to adopt rules to ensure single rounding.

Some computer languages and the IEEE 754-2008 standard dictate that in straightforward calculations the result should not be rounded twice. This has been a particular problem with Java as it is designed to be run identically on different machines, special programming tricks have had to be used to achieve this with x87 floating point.[...]

Brian Barker


--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.