Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Is Bankers Rounding used in NAV?

Posted on by 3,079

Dynamics CRM uses Bankers Rounding for currency - basically whenever the relevant digit is a 5, sometimes it rounds up and sometimes down so things aren't always skewed one way or the other.  Post with more details here:  https://community.dynamics.com/crm/b/crmpowerobjects/archive/2013/09/23/rounding-numbers-in-microsoft-dynamics-crm

Does NAV do the same, or not?  It seems like it would, since 1. that's a built-in .NET functionality, and 2. you'd think MS products would be consistent, but I haven't been able to find clear documentation one way or the other.  I was able to find definitive documentation that quantities where the relevant digit is 5 would always be rounded up, but nothing about currency amounts.

Can anyone confirm?  And does anyone that uses both systems have any insight, if they do both do the rounding differently?  It's obviously a minor amount, but still...you don't want these weird floating pennies being different.

*This post is locked for comments

  • awalters Profile Picture
    awalters 3,079 on at
    RE: Is Bankers Rounding used in NAV?

    Wow - that seems crazy that something as simple as rounding to 2 decimal places might not happen correctly.  It does seem consistent from instance to instance, though - so what would govern what happens when?  The bankers rounding seemed like a consistent way for it to work (and what at least a couple of us have witnessed), but you're saying it's not governed by rules that consistent, but by some weird processor quirk?  That's kind of unreal to me...

    Also, I'm astonished that there isn't any official documentation on this.  That's what I was really hoping to find, was just some official statement on how it was expected to work...:-(

  • Verified answer
    Jens Glathe Profile Picture
    Jens Glathe 6,092 on at
    RE: Is Bankers Rounding used in NAV?

    Oh there is some binary nastiness behind it, as far as I know. It is in the representation of floats in the IEEE-754 format. After all, it's a discrete value. It can introduce rounding"oddities" when the result, limited to what can be stored in the float format, is on the wrong side of a rounding rule. Please see here: community.dynamics.com/.../124340

    Additionally, there are some issues with rounding "chains" in NAV. Please see here: forum.mibuso.com/.../total-incl-vat-rounding-in-nav-2013-r2

    with best regards

    Jens

  • Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Is Bankers Rounding used in NAV?

    Allison, thanks, now I've got your point. Quite interesting!I had actually not been noticing the cases when figures in 5 are rounded down at certain cases, but I'll check with different instances and figure out the behavior.

  • awalters Profile Picture
    awalters 3,079 on at
    RE: Is Bankers Rounding used in NAV?

    Alexander - sorry, I should clarify.  We have those set - we're currently talking specifically about the case when the rounding type is nearest.  When it's set to nearest, and the relevant digit is 5, how does it behave?

    Interestingly, we just did more tests on a quantity field (assuming that the documentation above re: the digit=5 case was only for non-currency numbers), and found that the Bankers Rounding seems to apply there as well.  So with a precision of 2, we did 1.115 /10, and 1.125 / 10, and got 1.12 for both of these.  Which is actually inconsistent with that link, where it says that >= 5 will always round up.

    Anyone else seeing this behaviour other than us and Alex?

  • Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Is Bankers Rounding used in NAV?

    It is also a matter of setup for the rounding. If you would open the currency card, it has a special Rounding pane, where user can define Invoice Rounding Type with the options of Nearest, Up and Down, and also specify Invoice rounding precision and other rounding options.

    msdn.microsoft.com/.../hh168566(v=nav.90).aspx

  • awalters Profile Picture
    awalters 3,079 on at
    RE: Is Bankers Rounding used in NAV?

    Jonathan - right, but that function description just talks about decimal numbers, not specifically currency (which is often handled differently).  We just did some more tests, and like Alex, we appear to be seeing the Bankers Rounding (also called Gaussian Rounding or Round-to-Even, for people searching for this later) behaviour in those instances where currency figures have a 5 in the 3rd precision spot - i.e. 1.115 rounds to 1.12 and 1.125 also rounds to 1.12.

    This seems to be consistent with CRM, but I was just really surprised to not find it in the documentation anywhere other than the link you mention above, which doesn't say whether it applies to currency, so was curious what other people had experienced, or found in documentation.

  • keoma Profile Picture
    keoma 32,675 on at
    RE: Is Bankers Rounding used in NAV?

    for rounding in NAV C/AL function ROUND is used:

    NewNumber := ROUND(Number [, Precision] [, Direction])

    mostly used in code like e.g. ROUND(DecValue, 0.01), ROUND(DecValue, 0.00001).

    Direction can be =, <, >. Seldom used, default is =. That means >=5 goes up, <5 goes down.

    for details about precision and round up/down follow msdn.microsoft.com/.../dd301418(v=nav.80).aspx

    many precision settings are located in G/L Setup:

    for details follow moxie4nav.wordpress.com/.../setting-up-precisions

  • Verified answer
    Alex A Profile Picture
    Alex A 2,348 on at
    RE: Is Bankers Rounding used in NAV?

    Hi Allison,

    I think NAV does it the same way. I've seen instances in NAV while validating custom queries where sales amounts that have a 5 in the decimal place gets rounded up and other instances where a 5 in the decimal place gets rounded down, and until I read the link you posted I hadn't figured out what the logic was for this... but now it makes sense.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans