You described it in the most precise way.
I needed a function that would round down the number if the followin digit
is less then 5,
and would round up if the followin digit is greater then 5,
and if the followin digit is equal to 5 then it will test if the last digit
to remain in the number is odd or even and then round it up if it is odd or
leave as it is if it is even.
I think this is called "Round half to even" as a "tie braking rule".
But even more accurate description is here:
I must confess I did not have an idea that this was called "Gaussian
In my case the function needs to start from the least available right
standing digit for the given number and round consecutively from there to
the left untill the desired digit position is reached, one digit at a time .
This way it ensures that any boundary cases be treated correctly.
The practical need for this is when I had to fill in an invoice, on each row
I wold have an intermediate number which is a result of multiplication of
amount by unit price (i.e. an item's sum), which in the general case will
not be an exact number . Then I would need to round this number to a
sensible (currency) format and only then to add the numbers up in order to
get the final amount for the invoice. In this way all numbers add up
correctly and there is no difference in the final amount.
As for the example where 23,574 rounds to 23,57 , this is the intended
result as described above.
Thanks again for the clarification you've given in your post.
View this message in context:
Sent from the Users mailing list archive at Nabble.com.
To unsubscribe e-mail to: email@example.com
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
- [libreoffice-users] Re: Visible currency rounding (continued)
Impressum (Legal Info)
: 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