Subject | Re: [firebird-support] division by zero in FB2.5 |
---|---|
Author | Jesus Garcia |
Post date | 2011-10-24T18:14:34Z |
What is the value of mmbtu?
Jesus Angel Garcia Zarco
Cointec
Correo Móvil
El 24/10/2011, a las 17:18, Alan J Davies <Alan.Davies@...> escribió:
Jesus Angel Garcia Zarco
Cointec
Correo Móvil
El 24/10/2011, a las 17:18, Alan J Davies <Alan.Davies@...> escribió:
> Hi, has there been a change in the way division is done since FB 2.1[Non-text portions of this message have been removed]
> I realise I may be asking this question in the wrong list, but here goes.
> I have an SP which has been running since Feb 2009 every month with not
> one failure. Moving this to FB 2.5 results in failure every time.
> Basically all my routines are wrapped inside a coalesce statement such
> as this:
>
> water_tons = iif(water_pc=0,0,coalesce(tons*water_pc/100,0)),
> tons_water_tons = iif(water_pc=0,0.01,tons),
> ash_tons = iif(ash_pc=0,0,coalesce(tons*ash_pc/100,0)),
> tons_ash_tons = iif(ash_pc=0,0.01,tons),
>
> mmbtu_$ = iif(total_$=0 or tons<=1,0,coalesce(round(total_$/mmbtu,2),0)),
>
> Have I consistently got this wrong and have just been lucky or have I
> coded this completely wrong and the divide an integer by zero happens
> because the calculation order is different?
> The error message is
> Arithmetic overflow or division by zero has occurred
> ......
> The code attempted to divide an integer value by an integer divisor of zero.
>
> Any help or advice on defensive coding in a different way gratefully
> accepted.
>
> Regards
> Alan
>
> --
> Alan J Davies
> Aldis
>