Subject RE: [Firebird-Architect] NUMERIC vs DECIMAL
Author Claudio Valderrama C.
Helen Borrie wrote:
> Is the InterBase docco correct in saying that NUMERIC(p, s) has a
> precision of not more than p, whilst DECIMAL(p, s) has a precision of
> at least p?

Helen, reading your newer email on this subject, are you worried about IB7
types or about FB types? I don't have paid any attention to IB7.

I will answer from FB perspective:

- Both numeric and decimal behave the same. Numeric isn't SQL compliant
currently.

- For both dialects, being "p" the precision, the internal storage is:
1 <= p <= 4 => smallint
5 <= p <= 9 => int

- For dialect 1
10 <= p <= 15 => double

- For dialect 3
10 <= p <= 18 => int64

FB follows the internal storage, so both
numeric(2,1) and decimal(2,1) have the same limits:
-3276.8 <= v <= 3276.7
thus both numeric(2,0) and decimal(2,0) have the same limits than plain
integers:
-32768 <= v <= 32767

If numeric was SQL compliant, the first case would allow only
-9.9 <= v <= 9.9
and the second, only
-99 <= v <= 99
but anyone knows this doesn't happen.

Never rely on documentation written by people that don't use the engine and
never rely on an engine whose programming team includes C newbies if that
language is used.
:-)

C.