Subject Re: [IBO] Re: Rounding problems
Author Pirtea Calin Iancu
----- Original Message -----
From: "Marco Menardi"
> Sorry but I don't see any problem in my setup.
> I use Dialect 3, so if you define something like numeric(15,4)
> Firebird stores it as scaled integer.
> If you lately in the client retrieve the fields with AsCurrency, you
> don't loose precision (of course, you have to assign to a currency
> variable).
> If you are using only integers values, why use scale integers? Use
> NUMERIC(18,0) on the database side, and AsInt64 on the client side.


I use Numeric(18,10) and Numeric(18,5).
At some point in the application I have to get a percentage from it
I cannot use AsCurrency with that, can I?
If I do I loose 8 or 3 digits!
I cannot use float either because I loose 3 or 4 digits.

So I end up using Double or Extended and believe me it's not fun
changing the code all over to do things like round(Value*100000)/100000.
It's making the code hard to read. Instead I read the Int64 Value as is
without scale and add or substract at will.

If you try to read a Numeric(18,5) into an Int64 you get an error.
If you read it as Currency you loose 3 digits.

Thats why I need AsInt64Raw. The Value under the hood is an integer so
I would like to use it as such.

I hope now I make more sense than before.


Thank you,


Best regards,
Application Developer
Calin Iancu, Pirtea
S.C. SoftScape S.R.L.
pcalin@...