Subject Re: [firebird-support] decimal vs numeric
Author Helen Borrie
At 04:27 PM 20/04/2004 +0800, you wrote:


>If i'm not mistaken, NUMERIC will return an exact number of digits while
>DECIMAL will return at least that number of digits.. So, NUMERIC(5,2) will
>give you up to 99999.99 while DECIMAL(5,2) will give you 99999.99 or more..

That's how it's meant to be, according to the standard. In Firebird, they
are the same; but NUMERIC is often chosen because it keeps your schema
definitions consistent with the standard.


> > What am I going to use to a field that represent money? and field at
> > represent quality in KILO unit?
>
>I always keep my money in integer formats.. floating points are no good as
>you
>may have rounding errors.. using either NUMERIC or DECIMAL would do just
>fine..

"Fixed decimal types for things you count, floating point types for things
you measure".

So the money one is solved easily.

The weight one depends on how you are using it. If you are buying and
selling items in units of Kilos, say to the nearest gramme, then
numeric(n,3) would be right (essentially, it's integer grammes conveniently
packaged into Kilos). You are still bean-counting.

But if you are recording something by weight, e.g. reading the output from
a scale attached to a manufacturing process to record how much "something"
went into it, for quality control purposes, you want to store it as double
precision because it's being *measured*.

/heLen