One windows excell page mentions that it uses the banking rounding method, which I believe is the round to nearest even. So, using that method 12.125 would round to 12.12, while 12.135 would round to 12.14.. With this method if next digit is 1,2,3,4 the number rounds down. If it is 6,7,8,9 it rounds up. If 0 it does nothing, but if it is 5, it has to check if the key pervious digit is an even or old number. If it is even, then it rounds down, if odd it rounds up.
The regular LibreOffice round uses the standard round function. Usually, the standard round is used, but know that some government regulations require the banking/roundeven or roundodd method. Was surprized that excell's would default to banking? Note sure why they don't provide one for each method, or have an option to set. On 5 Jun 2022 at 11:37, Johnny Rosenberg wrote: From: Johnny Rosenberg <gurus.knu...@gmail.com> Date sent: Sun, 5 Jun 2022 11:37:04 +0200 Subject: Re: [libreoffice-users] ROUND function consistency To: LibreOffice Användare <users@global.libreoffice.org> > Looks like a bug to me. 12.125 returns 12.12, but 12.1251 returns 12.13. > Both should return the same. > I guess this bug should be reported. > Meanwhile, you can make your own function that you can use. Here are two > different suggestions. > > 1: This one use the Calc built-in ROUND() cell function. Place it in "My > macros & dialogs". VBA compatibility mode is not needed. > > Public Function faRound(x As Double, d As Integer) > Dim Calc > Calc=createUnoService("com.sun.star.sheet.FunctionAccess") > faRound=Calc.callFunction("ROUND", Array(x, d)) > End Function > > 2: This one use the method we learned at school: > Public Function fRound(x As Double, d As Integer) > fRound=Int(10^d*x+.5)/10^d > End Function > > Test: > Print afRound(12.125, 2) > Result: 12.13 > > Print fRound(12.125, 2) > Result: 12.13 > > Print fRound(12.125, 1) > Result: 12.1 > > ... and so on. > > Kind regards > > Johnny Rosenberg > > Den sön 5 juni 2022 kl 04:46 skrev Steve Edmonds <steve.edmo...@ptglobal.com > >: > > > I have just put a basic macro together so it will calculate income tax > > due from our local tax rates. > > I needed to round the tax to the nearest cent so taking the easy route I > > added Option VBASupport 1 to use the available VB round function. > > > > I then noticed that the VB round function with say round(12.125,2) > > rounds down to 12.12 and the LO inbuilt spread sheet function ROUND with > > ROUND(12.125,2) rounds up to 12.13. > > > > Is rounding in this situation arbitrary or is there some some convention > > for consistency. > > > > Steve > > > > > > -- > > To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org > > Problems? > > https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ > > Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette > > List archive: https://listarchives.libreoffice.org/global/users/ > > Privacy Policy: https://www.documentfoundation.org/privacy > > > > -- > To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org > Problems? > https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ > Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette > List archive: https://listarchives.libreoffice.org/global/users/ > Privacy Policy: https://www.documentfoundation.org/privacy +------------------------------------------------------------+ Michael D. Setzer II - Computer Science Instructor (Retired) mailto:mi...@guam.net mailto:msetze...@gmail.com Guam - Where America's Day Begins G4L Disk Imaging Project maintainer http://sourceforge.net/projects/g4l/ +------------------------------------------------------------+ -- To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette List archive: https://listarchives.libreoffice.org/global/users/ Privacy Policy: https://www.documentfoundation.org/privacy