[fpc-pascal] Division by Zero - not raised exception

Sasa Zeman public at szutils.net
Sun Apr 16 11:34:45 CEST 2006

> We don't consider this as a bug, it's for delphi compatibility reasons.
> These expressions are evaluated at compile time, so it's something
> differnt. If you want to get an error, compile with -Cr.

The -Cr will point on error in the code, however, enabling range checking
will also affect on global speed performance.

Definition in documentation (RTL.pdf):
29.20 EDivByZero
29.20.1 Description
EDivByZero is used when the operating system or CPU signals a division by
zero error.
As defined, reported issue is a bug. As well globaly, in consistency terms.

Far I can see, the core of the problem is in definiton of Infinity constant
as 1.0/0.0 and NaN with ln(-1.0) or 0.0/0.0 Perhaps this is necessary to
avoid problem with probably difference between different CPU/FPUs. However,
IEEE specification should be followed by all of them and bits manipulation
to perform infinity should be enough, instead to calculate it (as is
performed currently).

More information about the fpc-pascal mailing list