[fpc-pascal] Division by Zero: EDivByZero and EZeroDivide

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Oct 19 17:09:12 CEST 2009


On 19 Oct 2009, at 17:04, Bart wrote:

> Could you comment on my opinion that in case of a floating point
> divide by zero error an EZeroDivide should be raised (or no exception
> at all depending on the FPU exception mask) and only in case of
> integer divide by zero (div operation) an EDivByZero should be raised?
>
> This was my original question and no one seems to have an opinion on  
> that.

I don't have an opinion on that either. I'm not sure how it would be  
technically possible with our current setup, as SysUtils intercepts  
run time errors and then converts these into exceptions based on their  
number. Since all divide-by-zero run time errors are 200, there's no  
way for sysutils to differentiate between the two at this time (which  
is probably the reason why it always raises EDivByZero).


Jonas



More information about the fpc-pascal mailing list