Subject Re: [firebird-support] Re: Numeric Calculation Error ?
Author Dimitry Sibiryakov
On 14 Jan 2005 at 9:49, kamen_lai wrote:

>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?

>> >> > select 0.00 - (13060.45*9.031631) - (13060.45*8.65) from

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.