Why is it that when I get access to perform a calculation in a query such as Expres1:=[value1]/100
I get an answer such as 0.850000023841858 instead of just .85? This is having an effect down the line and resulting in mathematical errors!
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Incorrect calculation!
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Incorrect calculation!
- This topic has 5 replies, 4 voices, and was last updated 24 years, 2 months ago.
AuthorTopicWSPlainsman
AskWoody LoungerMarch 11, 2001 at 11:37 pm #353806Viewing 1 reply threadAuthorReplies-
WScharlotte
AskWoody Lounger -
H. Legare Coleman
AskWoody PlusMarch 12, 2001 at 7:01 am #518424For the same reason that you don’t get .33 when you divide 1 by 3 in decimal arithmetic. When you convert [value1] and 100 to binary floating point numbers and thendivide them, the answer does not come out to excactly .85 because of rounding errors, it comes out to 0.850000023841858. You can fix this by changing your formula to:
Expres1:=Round([value1]/100,2)
In the above, the 2 is the number of decimal place to which you want to round, in this case 2 to give you .85.
-
WSPlainsman
AskWoody Lounger -
H. Legare Coleman
AskWoody PlusMarch 12, 2001 at 7:59 am #518428The value is not wrong, it is correct in the number system used by computers. In decimal, 2/3 to 14 decimals is: .66666666666667. Is that incorrect because the 6 in the 15th place caused the last digit to round up to 7? But, yes, if you want 14 digits, you will have to settle for the rounding error you get when you do deicmal arithmetic in binary floating point.
-
WSDouglas Martin
AskWoody LoungerMarch 12, 2001 at 2:30 pm #518450Define “wrong”!
Computers “like” to do arithmetic using the base 2 (i.e. binary) system. That’s no big deal for integers; what is an integer in one number system is an integer in any other number system. It DOES matter for floating point (i.e. fractions).
What is a repeating decimal in one base (e.g. 1/3 = 0.333333…. in base 10) is not necessarily a repeating decimal in another base. 1/3 in base 10 is 1/10 in base 3, which is 0.1 in base 3. 1/10 (or .1) in base 10 is 1/1010 in base 2, which is the repeating binary fraction .00110011….
That’s a long-winded way of saying that you’ll get rounding errors in floating point arithmetic on computers even where you might think that a particular fraction can be represented exactly.
There are often ways around that at a cost of efficiency or number range. For instance, if all you care about is 2 decimal places, you can multiply everything by 100 and work in integers (e.g. store cents rather than dollars). That’s basically how the currency type works except that it scales by 10000 rather than 100 to allow 4 decimal places.
PS Hey! I found somebody else with my initials!
-
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
hibernate activation
by
e_belmont
3 hours, 25 minutes ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
3 hours, 43 minutes ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
6 hours, 47 minutes ago -
Windows 11 Insider Preview build 26120.4151 (24H2) released to BETA
by
joep517
6 hours, 49 minutes ago -
Fixing Windows 24H2 failed KB5058411 install
by
Alex5723
9 hours, 59 minutes ago -
Out of band for Windows 10
by
Susan Bradley
11 hours, 32 minutes ago -
Giving UniGetUi a test run.
by
RetiredGeek
18 hours, 29 minutes ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
1 day, 2 hours ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
1 day ago -
Auto Time Zone Adjustment
by
wadeer
1 day, 6 hours ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
1 day, 4 hours ago -
Manage your browsing experience with Edge
by
Mary Branscombe
8 hours, 51 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
19 hours, 47 minutes ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
3 hours, 41 minutes ago -
Apps included with macOS
by
Will Fastie
1 hour, 33 minutes ago -
Xfinity home internet
by
MrJimPhelps
23 hours, 37 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
23 hours, 35 minutes ago -
Debian 12.11 released
by
Alex5723
2 days, 3 hours ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
2 days, 7 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
1 day, 10 hours ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
3 hours, 28 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
3 days ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
2 days, 14 hours ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
12 hours, 28 minutes ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
2 days, 19 hours ago -
Some advice for managing my wireless internet gateway
by
LHiggins
2 days, 2 hours ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
1 day, 4 hours ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
3 days, 12 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
1 day ago -
Does windows update component store “self heal”?
by
Mike Cross
2 days, 22 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.