473,395 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Rounding Frustration

I have a query that uses the Round function to change decimals into
whole numbers. For 4 years straight the thing has always rounded the
numbers in exactly the same way so that whenever I update my graphs,
the percentages for the historical data are always exactly what they
were the last time I ran the query. Now, for the first time my
percentages are all just slightly off and I have not changed the query.
The only thing I can think of is that it is rounding the numbers
differently. I have not upgraded to a new version of Access or
anything, so why would this be? The data types are all long integer.

Nov 13 '05 #1
13 1696
There have been no changes in the Round() routine that I'm aware of. Paste
the formula(s) you're using into a message so we can see if there is
something that doesn't look right.

--
Wayne Morgan
MS Access MVP
<dh**********@wrha.mb.ca> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I have a query that uses the Round function to change decimals into
whole numbers. For 4 years straight the thing has always rounded the
numbers in exactly the same way so that whenever I update my graphs,
the percentages for the historical data are always exactly what they
were the last time I ran the query. Now, for the first time my
percentages are all just slightly off and I have not changed the query.
The only thing I can think of is that it is rounding the numbers
differently. I have not upgraded to a new version of Access or
anything, so why would this be? The data types are all long integer.

Nov 13 '05 #2
Here is an example of the formula.

Round([SumOfHospital Quality Good]*0.5)

Nov 13 '05 #3
Are you aware of the algorithm Access uses for rounding numbers ending in 5
(in the place just past the least significant one)?
The number is rounded to the nearest even number - thus 4.5 rounds to 4,
but 3.5 also rounds to 4.
I don't know whether this is relevant to your case, but it's worth knowing
any time you're rounding.
And as others have stated, it hasn't changed in a long, long time.

Of course if you haven't changed the query, the question arises whether
you've(or someone else has) changed any of the data?
Do you have backup copies of earlier datasets? Do they still return the
same numbers?

<dh**********@wrha.mb.ca> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I have a query that uses the Round function to change decimals into
whole numbers. For 4 years straight the thing has always rounded the
numbers in exactly the same way so that whenever I update my graphs,
the percentages for the historical data are always exactly what they
were the last time I ran the query. Now, for the first time my
percentages are all just slightly off and I have not changed the query.
The only thing I can think of is that it is rounding the numbers
differently. I have not upgraded to a new version of Access or
anything, so why would this be? The data types are all long integer.

Nov 13 '05 #4
I've just recently read that access does random rounding for 5's -
sometime up and sometimes down. If this is correct, it's surprising
that anytime I ran my queries in the past 4 years I've always obtained
exactly the same percentages. You would think that they would vary
from time to time. I have checked the data and it does not appear that
it has changed.

Nov 13 '05 #5
de******@shaw.ca wrote:
I've just recently read that access does random rounding for 5's -
sometime up and sometimes down. If this is correct, it's surprising
that anytime I ran my queries in the past 4 years I've always obtained
exactly the same percentages. You would think that they would vary
from time to time. I have checked the data and it does not appear that
it has changed.


The sometimes is not random so you wouldn't see changes from one time to the
next. It just rounds to the nearest even number.

1.5 always rounds to 2
2.5 always rounds to 2
3.5 always rounds to 4
4.5 always rounds to 4
etc..

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #6
So is the pattern... even numbers round up and odd numbers round down?
If so, how would it handle 0.5? I would think it would round up, but I
believe I've seen it round down to 0.

Nov 13 '05 #7
That's good to know. If the rounding always follows this pattern, then
something else must have changed. I guess I'll be digging for awhile.
Thanks for the help.

Nov 13 '05 #8
I see nothing in the example you've given that should cause a problem. There
could be some corruption in the database or the data. Have you tried a
Compact and Repair? Have you tried the same values in another database file
to see what that gives you?

--
Wayne Morgan
MS Access MVP
<de******@shaw.ca> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Here is an example of the formula.

Round([SumOfHospital Quality Good]*0.5)

Nov 13 '05 #9
Yes I've tried all of that - no answers. Access should round 0.5 to
0, right?

Nov 13 '05 #10
If it is exactly 0.5, correct. If it is 0.500001, it will round to 1.
Eventually, if you put enough zeros in there, the decimal to binary
conversion will cause it to round the number to 0.5 before using the Round()
function and it will again round to zero.

--
Wayne Morgan
MS Access MVP
"Delores" <de******@shaw.ca> wrote in message
news:11********************@g43g2000cwa.googlegrou ps.com...
Yes I've tried all of that - no answers. Access should round 0.5 to
0, right?

Nov 13 '05 #11
On 30 Jul 2005 09:46:45 -0700, de******@shaw.ca wrote:
Here is an example of the formula.

Round([SumOfHospital Quality Good]*0.5)


I don't know why it would suddenly start acting differently than it did
before, but you are aware that, when you multiply floating point there is a
tiny rounding error that can occur in the lower bits depending what your
numbers are. Even what appears to be an integer in your original data might
or might not quite be depending whether you typed it or it was the result of
another calculation.

Try converting both numbers to currency before rounding, and see what happens.

Round(CCur([SumOfHospital Quality Good])*CCur(0.5))
Nov 13 '05 #12
Here is an example of the formula.

Round([SumOfHospital Quality Good]*0.5)

Nov 13 '05 #13
I am using the round command in a form. This is rounding the amount
good. But when I produce the report using that query the detail lines
are displaying the data correct but the total line has a difference of 2
cents.

How can I fix this?

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Norvin Laudon | last post by:
Hi, Can somebody explain the following, from the MSDN documentation for the "System.Convert.ToInt32(double)" function <quote> Return Value value rounded to the nearest 32-bit signed...
4
by: spebola | last post by:
I am using vb.net 2003 professional and I get the following results when using the round method: dim Amount as decimal = 180.255 Amount = Amount.Round(Amount, 2) Amount now contains 180.25. ...
8
by: Zorpiedoman | last post by:
Howcome: Dim D as decimal = .5D msgbox d.Round(D, 0) this returns "0" Now when I went to school .5 rounds UP to 1 not DOWN to zero?????!!! Documentation says this, but what the heck are...
2
by: Jiri Nemec | last post by:
Hello all, I have got one table with rounding values, table contains prices and round types. id price_from price_to rounding 1 0 1500 0.1 2 1500 ...
11
by: cj | last post by:
Lets assume all calculations are done with decimal data types so things are as precise as possible. When it comes to the final rounding to cut a check to pay dividends for example in VB rounding...
18
by: jdrott1 | last post by:
i'm trying to round my currency string to end in 9. it's for a pricing application. this is the function i'm using to get the item in currency: FormatCurrency(BoxCost, , , , TriState.True) if...
206
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
20
by: jacob navia | last post by:
Hi "How can I round a number to x decimal places" ? This question keeps appearing. I would propose the following solution #include <float.h> #include <math.h>
30
by: bdsatish | last post by:
The built-in function round( ) will always "round up", that is 1.5 is rounded to 2.0 and 2.5 is rounded to 3.0. If I want to round to the nearest even, that is my_round(1.5) = 2 # As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.