Subject Re: [ib-support] Float Precision set
Author Raymond Kennington
Jed Nicolau Filho wrote:
>
> Thanks Sean
>
> My problem is that I need only 6 decimal digits for numeric datatype that
> are all set as FLOAT !
>
> I need float for compatibility !

No you don't want float compatibility!! You need precise arithmetic for a fixed
number of decimals.

Delphi uses floats and this will give you the inaccuracies you show below.

IB/FB can use precise numerics and FB 1.5 (at least) can use float as well. You
must be careful how you write the Delphi floats to the database.

Perhaps you should use Delphi BCD, but I don't know how to do that and save to
IB/FB.

Saving to NUMERIC(18,6) should automatically round for you, but when you read
them into Delphi or other language, they will become floats again!

Use a DOMAIN to specify the type and then convert the types of the current
fields to use this DOMAIN.



>
> I am using Delphi 5/6 and when I set a number like 2,50 into a Double
> variable and send it to IB
> database store 2,499999999999999999999999999999999999999999....as possible.
>
> I need that the IB store 2,50 or at least 2,4999999 !
>
> I need to use FLOAT for compatibility !
> I try to truncate it in application but there is no effect !
>
> Thanks in advance
>
> Best Regards
>
> Jed
>
> ""Leyne, Sean"" <sleyne@...> escreveu na mensagem
> news:66187D861C1747499BE1365B74E0369120CBA8@......
> > Jed,
> >
> > > I need to use float for all numeric datatype. But I need only
> > > 6 decimal digits.
> >
> > But then it sounds like you want a exact precision/numeric data type,
> > like DECIMAL(18,6)
> >
> >
> > Sean

--
Raymond Kennington
Programming Solutions
W2W Team B