DECIMAL/NUMERIC fields rounded into TFloatField

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ecosoft.it
Posts: 12
Joined: Thu 01 Dec 2011 14:36
Contact:

DECIMAL/NUMERIC fields rounded into TFloatField

Post by ecosoft.it » Sat 12 Jul 2014 12:12

Hello,
I have tried to use UniDac with default settings and decimal values in order to view the limit over size of the decimal fields.

I have created on Firebird 2.5 this table:

CREATE TABLE TESTNUM
(
ID INTEGER NOT NULL,
NUM DECIMAL( 10, 2),
FLT DOUBLE PRECISION,
CONSTRAINT PK_TESTNUM PRIMARY KEY (ID)
);


Delphi XE6 + Unidac 5.39 create fields:
UniQuery1ID: TIntegerField;
UniQuery1NUM: TFloatField;
UniQuery1FLT: TFloatField;

When I edit on dbgrid or in TDBEdit the field NUM is automatically truncated of 2 decimal digits.
If I try to edit the field FLT it doesn’t limit the decimal digits.
Is it my impression but UniDac recognize the correct precision from DDL and automatically rounds the DECIMAL/NUMERIC fields?
If it is true, what is the round mode that you use?
If it is true, where can I find more information about this topic in the documentation?
If it is true, is it the same system with the other databases?


Thank you
Alessandro Savoiardo

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: DECIMAL/NUMERIC fields rounded into TFloatField

Post by PavloP » Mon 14 Jul 2014 13:20

UniDAC reads out metadata from the server and uses it for setting accuracy of displaying DECIMAL fields. For value rounding, standard rules are used : 0,1 .. 0,5 are rounded to 0, and 0,6 .. 0,9 - to 1. Rounding rules are not a specificity of our products, therefore they are not described in our documentation.
The specified behavior is not specific to InterBase/Firebird, but common for all database servers.

ecosoft.it
Posts: 12
Joined: Thu 01 Dec 2011 14:36
Contact:

Re: DECIMAL/NUMERIC fields rounded into TFloatField

Post by ecosoft.it » Mon 14 Jul 2014 22:11

Thank you,
everything is clearer now.

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: DECIMAL/NUMERIC fields rounded into TFloatField

Post by PavloP » Tue 15 Jul 2014 09:32

Feel free to contact us if you have any further questions.

Post Reply