Subject | Re: [firebird-support] Re: Numeric Calculation Error ? |
---|---|
Author | Sibylle Koczian |
Post date | 2005-01-14T11:10:15Z |
At 11:42 14.01.2005, Dimitry Sibiryakov wrote:
0.00 - (13060.45 * 9.031631 - 13060.45 * 8.65) =
0.00 - 13060.45 * (9.031631 - 8.65) = 0.00 - 13060.45 * 0.381631 < 0
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg
Tel.: (0821) 598-2400, Fax : (0821) 598-2410
e-mail : Sibylle.Koczian@...-Augsburg.DE
>On 14 Jan 2005 at 9:49, kamen_lai wrote:Would still give a negative result:
>
> >Sorry, I don't care about the figure after decimal point , but the
> >major problem is the integer part -230930 and 4984.
> >
> >1. The correct result should be positive but the first result is
> >netagive.
> >
> >2. -230930 is an error result
>
> Sorry, but if you substract two numbers from zero, result have to
>be negative. Probably, you forgot parentheses in the first case?
0.00 - (13060.45 * 9.031631 - 13060.45 * 8.65) =
0.00 - 13060.45 * (9.031631 - 8.65) = 0.00 - 13060.45 * 0.381631 < 0
> >> >> > select 0.00 - (13060.45*9.031631) - (13060.45*8.65) fromDr. Sibylle Koczian
>
> Calculations of operations with the same priority is performed from
>left to right.
>
> >RDB$DATABASE
> >> >> >
> >> >> > the wrong result is -230930.057593950041
> >> >> > but
> >> >> >
> >> >> > select 0.00 + (13060.45*9.031631) - (13060.45*8.65) from
> >RDB$DATABASE
> >> >> >
> >> >> > get correct result is 4984.2725939500006
>--
> SY, Dimitry Sibiryakov.
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg
Tel.: (0821) 598-2400, Fax : (0821) 598-2410
e-mail : Sibylle.Koczian@...-Augsburg.DE