Subject RE: [IBO] retrieving size and precision of numeric fields
Author Salim Naufal
My number has a precision of 2 on the database side. The example I chose
illustrates three guys going to the restaurant and splitting the bill by
three. The bill is $100. I am dividing by 3. Two should pay $33.33 and the
last one $33.34. The calculation I am doing is the following: the first two
will pay $100/3 and the third one the balance which should be $33.34. So, by
default, I use the onFieldChange trigger of the "Debit" field to compute the
Credit1.AsCurrency = Debit.AsCurrency / 3;
Credit2.AsCurrency = Debit.AsCurrency / 3;
Credit3.AsCurrency = Debit.AsCurrency - Credit1.AsCurrency -

This should ensure that Total Debit = Total Credit

Using IBOQuery Alone, I get the correct rounding done to 2 digits. Using the
ClientDatasets Linked to IBObjects, I get the 4 digits problem. It seems
that the DataSetProvider component is reading the size and precision fields
and giving it to the ClientDataSet.

Note that with IBX, this is done correctly.

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Monday, June 09, 2003 14:19
So, if your number is stored with a precision of two, then to arrive at a
result with a precision of 4 means you must have multiplied or divided by a
number which also had a precision of 2.

So what was your calculation?