Re: Display of Single Data Exported
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Tue, 20 Jun 2006 23:03:39 +0800
In a decimal system, there are many numbers that would require an infinite
number of decimal places to represent them, e.g. 1/3 or 1/7. That happens in
a binary system as well: many fractional numbers cannot be stored precisely
in 32-bits (single) or 64-bits (double.) This issue is not specific to
Microsoft Access: it is true of floating point numbers in all computer
software.
So, Access provides the currency data type, which is not a floating point
number, but a fixed point. It stores exactly 4 places of precision after the
decimal point (hundredths of a cent.) Effectively, the computer does integer
math with this type, and then adjusts the decimal point after the
calculation. Consequently, there is no floating point error. This is really
useful for currency data, but also for other things where you don't want
rounding errors, such as storing values in meters (the 4 decimal places
gives you tenths of a millimetre precision), kilograms (1/10th gram
precision), and so on.
In Access 2000, Microsoft introduced a scalable point data type - a Number
of size Decimal. Nice concept, but unfortunately, they didn't get it right.
Access cannot even perform a basic sort on this type, so it is really
unusable. More info:
http://allenbrowne.com/bug-08.html
So, Currency is worth keeping in mind of you need fractional value up to 4
decimal places, and don't have to handle enormous or miniscule numbers.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"TerryM" <TerryM@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:85FE5234-E730-4A65-880B-23AA01A31EB9@xxxxxxxxxxxxxxxx
Thank you that worked.
However, I'm quite stunned by your statement "The floating point types
(single and double) cannot store fractional values exactly".
Is that not the point of using such data types i.e. high precision.
Terry
"Allen Browne" wrote:
Change the data type to Currency.
The floating point types (single and double) cannot store fractional
values
exactly.
"TerryM" <TerryM@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:40E13E7C-9599-40DD-B6A6-D0EE7396A4B1@xxxxxxxxxxxxxxxx
I have a simple lookup table containing a list of standard expenses and
their
associated costs. The data type of the expenses is 'single' and
'currency'
format i.e. 2 decimal places.
When a table containing expenses is exported to Excel values are shown
not
as 2 decimal places but 13. When I return to the lookup table and move
to
an
entry e.g. 9.82 it displays 9.81999969482422. I've tried several times
to
enter the correct value but they always return the incorrect value.
I'm happy with the results of reports etc. as they display the correct
value
but the exported files appear misleading.
Any suggestions on how I can resolve my problem please?
.
- Follow-Ups:
- Re: Display of Single Data Exported
- From: TerryM
- Re: Display of Single Data Exported
- References:
- Re: Display of Single Data Exported
- From: Allen Browne
- Re: Display of Single Data Exported
- Prev by Date: Re: Display of Single Data Exported
- Next by Date: Importing Specific Fields from Word Doc. Table into Acess
- Previous by thread: Re: Display of Single Data Exported
- Next by thread: Re: Display of Single Data Exported
- Index(es):
Relevant Pages
|