Page 1 of 1

float roundto error numeric field

Posted: 09.01.2008, 15:51
by ibosah
field type numeric(18,4)


804533,289*
1994726,37=1604823767111,1298
zquery1.FieldByName('xx').AsFloat:=roundto(1604823767111,1298 ,-2);

1604823767111,1200
database commit after
1604823767111,1298

simpleroundto ,roundto,asnumeric
not ok;

found number test ed prg





1626800,4045
1551543,33=2524051316843,2796

1380010,7691*
474565,36=654905307441,8102

554270,3802*
1230910,93=682257469163,435586

1758713,9*
1626094,61=2859835193322,079

1380010,7691
474565,36=654905307441,8102


792037,798*
520022,12=411877174836,0901

Posted: 11.01.2008, 04:19
by cipto_kh
What database do you use and what type of field that you use?

Posted: 14.01.2008, 12:34
by ibosah
Mysql
Postgree
firebird

Numeric(18,4)

2524051316843,2700
after commit
2524051316843,2796

411877174836,0900
after post
411877174836,0901

delphi2006 delphi2007

Posted: 18.01.2008, 12:27
by andy
A type of (18,4) should be treated internally as Currency.
To avoid rounding problems.

But I don't know how to do it in Zeos.