Access math

  • Thread starter Thread starter PilotBob
  • Start date Start date
P

PilotBob

Very new to Access. Trying to set up simple math functions but am getting
strange answers. For example: If I subtract 3446.1 from 3446.5 I get .4 which
is correct. However when I left click it shows 0.4000000091 This is used in
further calculations and throws all of the future calcs off.

3448.6 - 3447.9 gives .7 or 069999998

I have tried all of the various settings in properties (Integer, single,
double, etc..) The one that works best and gives the fewest errors is TEXT.
But this is clearly not text.

I would appreciate an e-mail response if possible (e-mail address removed)
 
Very new to Access. Trying to set up simple math functions but am getting
strange answers. For example: If I subtract 3446.1 from 3446.5 I get .4 which
is correct. However when I left click it shows 0.4000000091 This is used in
further calculations and throws all of the future calcs off.

3448.6 - 3447.9 gives .7 or 069999998

I have tried all of the various settings in properties (Integer, single,
double, etc..) The one that works best and gives the fewest errors is TEXT.
But this is clearly not text.

The examples above suggest that you were using either Double or Single.
Integer or Long Integer will not support any decimal places at all, and you
can't do math directly with Text (Access will convert the text string to
Double if you try).

Single and Double datatypes are "Floating Point" numbers. They're stored as a
binary fraction times an exponent; as such, they are *approximations*. Just as
the fraction 1/7 cannot be expressed exactly as a decimal fraction, so the
fraction 4/10 cannot be expressed exactly as a binary fraction - it's an
infinite repeating series of bits, just as .142856142856 is an infinite
repeating series of digits.

If you can settle for exactly four (no more, no fewer) decimal places, don't
use any of the Number datatypes but instead use a Currency datatype. It's a
scaled huge integer with a range into the trillions, offset to give four
decimal places. Or, with A2002 or later, you can use the Decimal datatype and
specify the precision and number of decimal places.
I would appreciate an e-mail response if possible (e-mail address removed)

That's considered an impolite request here. We're all volunteers, donating our
time to the newsgroups; I'm a self-employed consultant as are others. Private
email support is reserved for paying customers. Ask here... come here for the
answer (and let others benefit from the answer as well).

John W. Vinson [MVP]
 
Back
Top