Subject | Re: [firebird-support] Paradox & Firebird |
---|---|

Author | Helen Borrie |

Post date | 2005-01-02T04:30:21Z |

At 06:55 PM 1/01/2005 +0000, you wrote:

either store or calculate numerics exactly (other than by storing all

numbers as integers and storing their scale yourself).

If your client insists that results from Paradox and Firebird must be

identical, then Paradox Numeric and Firebird Double Precision are going to

give you two different sets of inaccurate results.

The reasonable thing to do would be to fix them *both* so that both will

reliably store and calculate with the degree of precision/exactness that

your application requirements dictate. You can get some insights into the

traps with precision, scale and floating point numbers by grabbing Geoff

Worboys' small treatise on the subject of numbers and Delphi, from

http://www.ibobjects.com/TechInfo.html. Once you've researched the

subject, I daresay you and your client will Need To Talk. :-)

btw, on the subject of "wild" results, don't neglect the SQL standard

that's implemented in Firebird for integer division. In old IB versions,

in delphi and in Paradox, integer/integer produces a floating-point

result. Under SQL rules, it produces an integer. Thus it is, for example,

that 10/3 is 3, not 3.333333333; and 1/3 is zero, not 0.33333333....

./heLen

>Hi All,I would say it's *not* a reasonable goal. Paradox has no capacity to

>

>I'm supporting 2 applications for a client. One uses Paradox as a

>database and the other Firebird 1.5. I have reports in both

>applications that calculate numbers that my client insists must match

>exactly. My problem is with differences in the way Paradox and

>Firebird stores numeric values, causing rounding errors that I can't

>seem to correct.

>

>My Paradox tables are all defined with Numeric fields (15 significant

>digits) and the Paradox application calculates all the numbers using

>the Double datatype in Delphi. In my Firebird application, I've had

>to define my Firebird database to use all Double precision (which I

>think is a close as I can come to the Paradox Numeric) and I'm

>calculating all the numbers in stored procedures using Double

>Precision datatypes.

>

>However, I'm unable to get stored procedures in Firebird to calculate

>numbers exactly the same as the numbers calculated in the Paradox

>application even though I've calculated the results in the same way as

>the Paradox application.

>

>Is it possible to get these numbers to match exactly? Is this a

>raasonable goal?

either store or calculate numerics exactly (other than by storing all

numbers as integers and storing their scale yourself).

If your client insists that results from Paradox and Firebird must be

identical, then Paradox Numeric and Firebird Double Precision are going to

give you two different sets of inaccurate results.

The reasonable thing to do would be to fix them *both* so that both will

reliably store and calculate with the degree of precision/exactness that

your application requirements dictate. You can get some insights into the

traps with precision, scale and floating point numbers by grabbing Geoff

Worboys' small treatise on the subject of numbers and Delphi, from

http://www.ibobjects.com/TechInfo.html. Once you've researched the

subject, I daresay you and your client will Need To Talk. :-)

btw, on the subject of "wild" results, don't neglect the SQL standard

that's implemented in Firebird for integer division. In old IB versions,

in delphi and in Paradox, integer/integer produces a floating-point

result. Under SQL rules, it produces an integer. Thus it is, for example,

that 10/3 is 3, not 3.333333333; and 1/3 is zero, not 0.33333333....

./heLen