[fpc-pascal] math with infinity and NaN
gtt at wolfgang-ehrhardt.de
gtt at wolfgang-ehrhardt.de
Thu Jun 21 15:32:06 CEST 2018
Zitat von James Richters <james at productionautomation.net>:
>> For operations producing results in floating-point format, the
>> default result of an operation that
>> signals the invalid operation exception shall be a quiet NaN that
>> should provide some diagnostic
>> information (see 6.2).
>
> If it shall be a quiet NaN doesn't that mean it would never cause
> the runtime error? To my understating signaling NaN raises the
> exception, and Quiet Nan does not.. it just quietly sets the
> variable to NaN and continues by default.
> It states that the DEFAULT result shall be this quiet NaN so if
> that's the case then setting SetExceptionMask([exInvalidOp]); should
> not be required to prevent the runtime error. The default behavior
> should be that it's a Quiet NaN.
As far as I understand: if the exInvalidOp is masked the default result
is a quiet NaN. If exInvalidOp is not masked the excption is thrown.
(I do not know if a result is set to NaN and how this could be exploited).
More information about the fpc-pascal
mailing list