Currency vs Double

G

Guest

Using Access2003

Is there any disadvantage to using "Currency" vs "Double" when dealing with
actual currency numbers? I understand that Currency will only go to 4
decimal places (which is fine), and I've read that it's more stable for
floating point math.

I just wanted to know is there any drawbacks (like the Digits has). Does
Currency convert well to SQL Server?

TIA

Aaron G
Philadelphila, PA
 
J

John Vinson

Using Access2003

Is there any disadvantage to using "Currency" vs "Double" when dealing with
actual currency numbers? I understand that Currency will only go to 4
decimal places (which is fine), and I've read that it's more stable for
floating point math.

I just wanted to know is there any drawbacks (like the Digits has). Does
Currency convert well to SQL Server?

Currency is a scaled huge integer, with exactly four (no more, no
fewer) decimal places; no roundoff error; and a range into the
trillions. It is fixed point and does NOT support floating point math
- for example, if you divide a Currency value of 1.0 by a Currency
value of 50000., you will get a Currency result of 0.0000 (since
0.00002 exceeds the four decimal limit).

Double is a Floating Point number with approximately 17 decimals of
accuracy and a range up to 10^308 or thereabouts. However, as a
floating point number it DOES have roundoff error - for example, 0.1 +
0.2 + 0.3 + 0.4 does NOT equal 1.0 but rather 0.99999999999999997 odd:

?1.0 - (0.1 + 0.2 + 0.3 + 0.4)
-2.77555756156289E-17

It's "stable" - you'll always get the same approximation for the same
expression - but it's still *an approximation*.

John W. Vinson[MVP]
 
G

Guest

John,

Just what I was looking for. Thanks for your time.

Aaron G
Philadelphia, PA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top