Re: Phantom decimal places
From: Allen Browne (AllenBrowne_at_SeeSig.Invalid)
Date: 10/14/04
- Next message: Julian Stevens: "Afterupdate only works on first combo"
- Previous message: John Vinson: "Re: Phantom decimal places"
- In reply to: Brian: "Phantom decimal places"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 15 Oct 2004 00:52:13 +0800
These inaccuracies are inherent in floating point numbers.
Some numbers (e.g. 1/3) cannot be represented accurately as a decimal, as
they require an infinite number of decimal places. Your computer can provide
around 7 or 8 accurate places (for a Number of size Single) or double that
(for a Number of size Double).
If you do not need more than 4 decimal places, you can use a Currency type
instead. Currency is a fixed-point type, not a floating-point type, and so
it avoids the rounding problems.
If you need more places, consider using a Double rather than a single, and
rounding the results of your calculations using the Round() function so the
small errors are not aggregated.
-- 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. "Brian" <Brian@discussions.microsoft.com> wrote in message news:F5002622-38A0-4F6F-9AE3-7B8B8B30838F@microsoft.com... >I have field defined as number/single. When performing simple DLookups >an/or > simple calculations on them and then displaying the result in text boxes, > it > is often displayed with extra digits. For example, an entry that was > calculated as 30 - 30.22 shows -1.7800007. > > The text box itself has decimal places set to Auto (which is correct, > because it could vary) and no format, although General Number format > produces > the same result. The result is also the same whether or not the format in > the > table is blank or General Number. > > How do I get numbers to display the correct data without the ghost decimal > places?
- Next message: Julian Stevens: "Afterupdate only works on first combo"
- Previous message: John Vinson: "Re: Phantom decimal places"
- In reply to: Brian: "Phantom decimal places"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|