On Tue, 9 Nov 2004 15:13:41 -0500, "Joe Williams" <(E-Mail Removed)>
wrote:
>Can anyone enlighten me as to the "floating point problem"? I use double all
>the time. Thanks
As Allen says, the problem is that a Double is *an approximation*.
Just as 1/7 or 1/3 cannot be represented exactly as a decimal fraction
(both are infinite repeats, .142856142856142856... and .3333...
respectively), so many numbers cannot be represented exactly using the
binary fractions in Float or Doubles.
Among the numbers that cannot be represented are such values as 0.1 or
0.01 - and these (surprise!) turn up pretty often in currency data!
Any calculations done with Doubles will be accurate to some 14 decimal
places (24 bits), which is fine for most purposes. Where you will run
into trouble is *testing equality* - depending on how you arrive at
the value, what *LOOKS* like 1.74 in two different tables might be
1.739999999999981 in one and 1.74000000000003 in another. Attempting
to join these two tables on such a field, or even use a query
criterion, will miss data.
John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps