Subject Re: [firebird-support] Overflow on multiplying decimals
Author Ann W. Harrison
Maya Opperman wrote:
>
>
> IQTY decimal(18,3) = 100.000
> IPRICE decimal(18,2) = 4,039,250,052,178.13
> OEXTENDEDPRICE decimal(18,2) will be 403,925,005,217,813.00 (still within 18 significant digits, 17 actually)
>
> I tried
>
> OExtendedPrice = cast((IPrice * IQty) as decimal(18,2));
>

You have to cast the individual fields so the intermediate
result doesn't overflow.


Good luck,

Ann