Subject Re: Firebird Roundoff Error
Author Svein Erling Tysvær
Precision, Niegil.

Divide 2536.68 by 30 and you get 84.556. But since 2536.68 only has
two decimals and 30 has none, Firebird decides the answer should have
two decimals and gets 84.55.

If you use 2356.680 or 30.0, you would get the same result in your
three calculations. In general, be careful about truncation when
calculating things with Firebird.

Set

--- In firebird-support@yahoogroups.com, "niegil_firebirddev" wrote:
>
> Hi All,
>
> We are having a conversion Project from Paradox to firebird . Now i
> have a query in paradox like below
>
> 1) select ((2536.68/30)*2.5) as RND from TestTable
>
> The value that paradox returns for the field RND is 211.39
>
> 2) Now when this same query is run in firebird
>
> select ((2536.68/30)*2.5) as RND from TestTable.Then value that i
> get is 211.375
> i tried the same query changing it as select ((2536.68/30)*2.5)
> as RND from TestTable got the same value.
> Now when i change the query as
> select 2536.68*2.5/30 as RND from TestTable or select
> ((2536.68*2.5)/30) as RND from TestTable,
> i get the same value that paradox returns (211.39)
>
> Can anyone suggest the exact reason for the same .Where as both
> the way calculation should be same (As calculatior returns)
>
> Thanks in advance
>
> Regards
> Niegil J THomas