Numbers, EURO and Float

sergio7

Member²
Hi,

i have a little question. The number(x,y) oracle datatype is a fixed point type. DOA maps number(x, y) as Double (floating point type). Are there rounding errors risks ? I need to perform financial calculations and i have trouble using floats.
Can i safetly use TFloatFields ?

TIA

Sergio Sette
 
With a floating point number representations you always have rounding error risks. A double has 15/16 digits precision, so you probably don't need to worry about errors during calculations, when displaying values, or when reading/writing values from/to the database (which will be rounded correctly).

However, when comparing values you should always be aware of floating point inaccuracies.

------------------
Marco Kalter
Allround Automations
 
Originally posted by mkalter:
With a floating point number representations you always have rounding error risks.


Markus,

if i have a number like number(6, 2) this can be mapped as a TBCDField that internally is a Currency (fixed point). Why have you choosed to allways rapresents numbers as Floats ?

Regards

Sergio Sette
 
Originally posted by mkalter:

However, when comparing values you should always be aware of floating point inaccuracies.


Hallo Markus,

Delphi6 introduces new variant types and a true BCD field (TFMTBCDField).
Are you planning to use bcd instead floats.

Regards

Sergio Sette
 
Real numbers are always represented as floats, because this is the most SQL*Net / Net8 / Delphi version independent representation.

We have had more requests to support a currency representation for financial applications though, so this may change in the near future.

------------------
Marco Kalter
Allround Automations
 
Back
Top