Subject | Re: [firebird-support] Mathematics problem |
---|---|
Author | Aage Johansen |
Post date | 2005-10-07T21:35:14Z |
miki_avramovic wrote:
1.
select (109.87 - 5*109.87/100) from rdb$database
= 104.38
2a.
select (109.87 - 5*(109.87/100)) from rdb$database
= 104.42
2b.
select cast((109.87 - 5*(109.87/100.00)) as decimal(9,2))
from rdb$database
= 104,38
3.
select (109.87 - (5*109.87)/100) from rdb$database
= 104.38
--
Aage J.
> I founded a little problem with evaluation of this formula in procedureTesting with Fb/1.5.2 SS [WI-V6.3.2.4731 Firebird 1.5] (dialect 3):
> or trigger:
> PC = 109.87
> RABAT_PROC = 5
>
> 1. case:
> PCR = PC - RABAT_PROC * PC / 100; Result for PCR is 104.291 (OK)
> 2. case:
> PCR = PC - RABAT_PROC * (PC / 100); Result for PCR is 109.33 (Bad)
> 3. case:
> PCR = PC - (RABAT_PROC * PC) / 100; Result for PCR is 109.33 too
> (Bad)
> My version of Firebird server is 1.52. I try with both of classical and
> super server.
1.
select (109.87 - 5*109.87/100) from rdb$database
= 104.38
2a.
select (109.87 - 5*(109.87/100)) from rdb$database
= 104.42
2b.
select cast((109.87 - 5*(109.87/100.00)) as decimal(9,2))
from rdb$database
= 104,38
3.
select (109.87 - (5*109.87)/100) from rdb$database
= 104.38
--
Aage J.