Re: Currency Datatype Really Good to Use For Non-currency Fields?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Thu, 6 Jul 2006 13:04:09 +0800, "Allen Browne"
<AllenBrowne@xxxxxxxxxxxxxx> wrote:

Currency has the advantage that it is a fixed point number (exactly 4
decimal places.) That means it has none of the rounding issues inherent in
floating point types (Single and Double.) It is therfore ideal for number
that must include a fractional part, but where you don't want rounding or
matching errors.

For example, you could use it to store distances in metres, provided you
don't need anything smaller than one tenth of a metre.

Disadvantages:
a. Cannot handle minute or enormous values the way floating point fields
can.
b. According to the documentation, it may be slower to calculate, though I
have not observed this.
c. You need to specify the Format, so it does not display as currency.

Access 2000 introduced the Decimal type: a scalar number where you can
specify the number of decimal places. Unfortunately, it is not correctly
implemented, so even a basic sort fails, so I suggest you don't use this
type. Details:
http://allenbrowne.com/bug-08.html


Thanks Allen. Your information gives my confidence a boost.
It seems that the currency datatype should do just fine for
some of my fields.
--
tbl
.



Relevant Pages

  • Re: Avoiding floating points
    ... "Add Fixed and Floating Decimal Point Numbers to Delphi" ... fraction numbers. ... And if you do allow for rounding the result into a ... then you need to specify or know what ...
    (borland.public.delphi.non-technical)
  • Re: Why not FP for Money?
    ... I had started with the assumption that the IEEE 754 rounding methods ... accounting has rules about rounding, ... Floating point arithmetic is useful for continuous quantities, ... applies here if you are dealing with actual pennies. ...
    (comp.lang.python)
  • Re: converting float to double
    ... Although I can not see a guarantee from your floating ... rounding, it does not generalise to, e.g., ...
    (comp.lang.c)
  • Re: Bug in Delphi SimpleRoundTo function?
    ... calculations also use bankers rounding. ... rounding rule that most programmers can agree on. ... the trap of using floating *binary* point numbers, ... to represent decimal fraction ...
    (borland.public.delphi.non-technical)
  • Cfv: Floating point truncation
    ... RfD: Floating point truncation ... which, respectively, provide rounding to the nearest integer, and rounding to the nearest integer on the side of the number line towards negative infinity. ... ANS Forth does not provide a word for rounding towards zero, and returning a floating point representation of the resulting integer. ... Include a standard word, named "FTRUNC", to perform "truncation", i.e. rounding of a floating point number towards zero, returning a floating point representation of the resulting integer. ...
    (comp.lang.forth)