Subject Re: Numeric, Decimal, Double Precision and Float data types. What and when to use?
Author csswa
Hi Theo. You say you've read the manuals, but even so, I refer you
to page 19 of Langref.pdf. From there to the numerics section in
Datadef.pdf.

The only remaining confusion you should have is about when to user
DECIMAL(X,Y) and NUMERIC(X,Y). Use NUMERIC. The other is rarely
needed.

So, to recap...

SMALLINT -- 16 bits, –32,768 to 32,767

INTEGER -- 32 bits, –2,147,483,648 to 2,147,483,647

NUMERIC(18,0) -- 64 bits, -9223372036854775808 to
9223372036854775807. Yes, Firebird needs a BIGINT or INT64 keyword to
replace this usage. For now we are stuck with this.

NUMERIC(X,Y) -- A number with X digits, of which Y are for decimal
places, e.g. numeric(12,3) contains at most 12 digits, of which 3
will be used for decimal places (leaving nine digits to the left of
the decimal place).

FLOAT -- 32 bits, IEEE single precision: 7 digits

DOUBLE PRECISION -- 64 bits, IEEE double precision: 15 digits

Do some hands on experimenting to get a feel for it. Create a table
with the different numeric types and plug in different values.
Deliberately enter invalid numbers to confirm your understanding of
numerics and precision. The hands-on A-HA! factor is pretty
important when learning things like Interbase.

Regards,
Andrew Ferguson
-- All your babes are belong to me.


--- In ib-support@y..., "Theo Bebekis" <teo@e...> wrote:
> Hi
>
> could please someone give me more details, than those
> provided by Interbase docs, about those data types?
> Is there any white paper providing more info on the issue?
>
> What do you recommend me to use?
> Numeric and Decimal or the IEEE types (Double and Float)?
> Does it depends? On what?
>
> Also...
> I see that MASTSQL database, provided with some of Delphi's demo
apps,
> uses DOUBLE PRECISION for ORDERNO and CUSTNO
> of the ORDERS table to name a few cases.
>
> Is that a wise decision? Why not just INTEGER?
> Usually that kind of fields are of the INTEGER type, or not?
>
> ORDERNO is the primary key where CUSTNO is foreign key to
> CUSTOMER table.
>
> I feel I'm missing something critical here...
>
> Regards
> (stressed today) Theo
>
> PS. I use Firebird
> -----------------------------------
> Theo Bebekis
> Thessaloniki, Greece
> bebekis@o...
> teo@e...
> -----------------------------------