[AccessD] Round function strangeness

Bill Benson bensonforums at gmail.com
Wed Jan 24 11:35:34 CST 2018


Doug had an issue in a query not in VBA.

On Jan 24, 2018 1:58 AM, "Gustav Brock" <gustav at cactus.dk> wrote:

Hi Doug

A random sample works as expected here:

a = CSng(15.17345)
b = CSng(23.23498)
? a, b, Round(a * b + 1, 1), Round(a * b, 1)
 15.17345      23.23498      353.6         352.6

But Round is known to be buggy, though I haven't met the scenario you
scenario you describe.
Could you provide some of your value sets, please?

And - thanks Jack - for any serious use of rounding, I strongly recommend
using my rounding functions that will never fail:

https://www.experts-exchange.com/articles/20299/Rounding-
values-up-down-by-4-5-or-to-significant-figures.html

or:

https://www.codeproject.com/Tips/1022704/Rounding-Values-
Up-Down-By-Or-To-Significant-Figur

/gustav

-----Oprindelig meddelelse-----
Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] På vegne af Doug
Steele
Sendt: 23. januar 2018 19:13
Til: Access Developers discussion and problem solving <
accessd at databaseadvisors.com>
Emne: [AccessD] Round function strangeness

I used the Round function in a query that had 2 calculated fields. The
first one was a calculation like a*b+1, the second a straight
multiplication: a*b. The output from Round(a*b+1,1) was correctly rounded
to one decimal place. The output from Round(a*b,1) wasn't rounded off at
all. But when (in desperation), I changed this to Round(a*b+1-1,1), which
is ridiculous, the output was rounded off correctly!

Any comments?

Doug

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list