Rounding Issue

M

MDB

I ran into a problem with rounding and was wondering if anyone knows of a
work around with out manually rounding numbers. Math.Round doesn't seem to
use the standard in rounding (at least what I have always been taught). For
example math.round would round .925 as .92 however, I have always rounded
and been taught that .925 should be rounded as .93. Are all my years of
math classes wrong or is Microsoft using a new way to round numbers because
I just found out that using math.round to calculate taxes can now be a penny
off from are main non .net application which does our reporting.
 
P

peter

after reading through this info I found this to work:

10.255
symup( 10.255 , 100) '100 for the hundreths location 10
for tenths
to round to 10.26



Function SymUp(ByVal X As Decimal, _
Optional ByVal Factor As Decimal = 1) As Decimal
Dim Temp As Decimal
Temp = Fix(X * Factor)
SymUp = (Temp + IIf(X = Temp, 0, Sign(X))) / Factor
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top