Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Round function rounding rules 1

Status
Not open for further replies.

Suraklyn

Programmer
Aug 12, 2002
42
0
0
US
After a quick search, I'm now aware that the Round function rounds using business rounding rules. I'm still trying to find out what these rules are.

Is anyone here familiar with what these rules are?
--
Jonathan
 
The round function uses mathematical rules, not business or financial rules.

The mathematic round rule states that the decimal digits get rounded so that the last digit, after the rounding, is always an even number. This is sometimes why a .5 may round down and not up.

Round(0.05, 1) = 0
Round(0.15, 1) = 0.2
Round(0.25, 1) = 0.2
Round(0.35, 1) = 0.4
Round(0.45, 1) = 0.4
Round(0.55, 1) = 0.6
Round(0.65, 1) = 0.6

The financial rules state that this last digit doesn't matter if it is even or not.
The first digit after the decimal-place-to-round-to rounds up if >= 5, and rounds down if < 5.

Round(0.05, 1) = 0.1
Round(0.15, 1) = 0.2
Round(0.25, 1) = 0.3
Round(0.35, 1) = 0.4
Round(0.45, 1) = 0.5
Round(0.55, 1) = 0.6
Round(0.65, 1) = 0.7
[/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Was this what you meant?

By the way, I hope I wasn't misleading you with the Round().

The VBA Round function uses Mathematical rounding.
The VBA Format$ function uses financial rounding. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Well, the search I ran found this at Microsoft:


It states Round uses business rounding rules. I don't know these rules, so I couldn't state whether this is right or not. The deals you describe do go along with the things I've noticed over the last couple of days, so I'm going along with your thoughts.

I wouldn't be surprised if the MS documentation was wrong. It wouldn't be the first time it was.

Thanks. --
Jonathan
 

How dare you say that! LOL [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top