Subject Re: [firebird-support] FB 2.1.3 Error: The result of an integer operation caused the most significant bit of the result to carry.
Author Dimitry Sibiryakov
> I'm not sure why do I get this message "The result of an integer
> operation caused the most significant bit of the result to carry."
> I'm using FB 2.1.3
>
> This is the line that raises exception:
>
> V_DIFF = - V_AMOUNT * V_SIGN * V_RATE;
>
> These are declarations
>
> declare variable v_sign numeric(18,2);
> declare variable v_diff numeric(18,2);
> declare variable v_rate numeric(18,10);
> declare variable v_amount numeric(18,2);

numeric(18,2)*numeric(18,2)*numeric(18,10) = numeric(18,14).

> Using
>
> CAST((V_AMOUNT * V_SIGN * V_RATE) as numeric(18,2)
>
> doesn't help

Cast result of one multiplication.

SY, SD.