Subject | Re: [firebird-support] Precision question |
---|---|
Author | Martijn Tonies |
Post date | 2009-02-11T10:52:50Z |
>I don't think you can expect a division to return an exact value. Suppose ITo avoid this 1 cent difference, I'd rather lend you 3 Euros.
>borrowed 1 euro from Martijn at the last Firebird Conference and should pay
>it back in three equal installments. 1.00/3 rounds to 33 eurocent, so
>Martijn would only get back 99 eurocents. If I did (3*1.00)/3 I would get
>1.00, if I did 3*(1.00/3) I would get 0.99 (and if I did 3*(1.00/3.00) I
>think I would get 0.9999). I don't quite understand your problem (whether
>the result is too accurate or inaccurate), but maybe
>
> CAST(BRUTTO_AR*cast(:BEF_OSSZEG/:FOSSZEG AS NUMERIC(18,2)) AS
> NUMERIC(18,2))
>
> can be what you're looking for?
With regards,
Martijn Tonies
Upscene Productions
http://www.upscene.com
Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!
Database questions? Check the forum:
http://www.databasedevelopmentforum.com