I have a database with numbers stored in the money datatype, for example 11.83
If I extract that from a RecordSet with DoubleValue I’ll get something like 11.83000000001.
If I extract it with StringValue I get a string with “11.83”
However I want to add and subtract these values, without losing precision, so how would I work with these strings without losing precision through conversions to double?
oh, just to forestall some postings, yes, I know why the number shows up as 11.8300000001, the inability of the double type to accurately represent numbers that are not a binary fraction.
BCD arithemetic is one way, but isn’t there a better way ?
[quote=319928:@Kent Sorensen]oh, just to forestall some postings, yes, I know why the number shows up as 11.8300000001, the inability of the double type to accurately represent numbers that are not a binary fraction.
BCD arithemetic is one way, but isn’t there a better way ?[/quote]
For financial apps BCD is likely the best way since they usually behave about how accountants expect (at least in my experience with various languages that supported a BCD type they did)