Subject Strange roundings in IB-5.6
Author Entrebytes S.L.
IB 5.6 + Mandrake Linux 7.2

Hi gang.

I'm getting very angry about a quirk of Interbase with double precision
values.
I store in a Double precision field (Importe) , the value 8200.14
Interbase holds 8200.13999999999999999
Well... not inusual. I know about some glitches in the Delphi way of storing
double values , so i make a external function ,

ndecimals(numero,decimales)
where numero stands for a double precision and decimales for an integer that
gives the number of decimals required at most.

The C functions looks like
switch decimales {
2 : return rint(*numero*100)/100
......

I compile , link , declare the external , etc...

when in ISQL using the function in a select as

select nombre , orden_carga , ndecimals(importe,2) from v_excel_oc

(in fact , is a view , but it should'nt matter)

i got a lot of perfectly suitable values (in fact , i know that some of then
has been corrected by the ndecimals fuction because if i do it straight ,
without the function , somes a large number of decimals) , except the dammed
8200.1399999999999

So , now , i know is interbase who is lying to me , not the bloody Delphi 4
and his wicked arithmetics.

Any ideas to lower my blood presure?


B.T.W. . Could someone tell me what system table i should query to ascern
the code for creation of the user tables ? Sort of a extract database in
isql , but by delphi code / sql query.


Javi
EntreBytes S.L.
Ontenient , Spain
ERP Development.