IsNaN crashes
Original Reporter info from Mantis: BeniBela @benibela
-
Reporter name: Benito van der Zander
Original Reporter info from Mantis: BeniBela @benibela
- Reporter name: Benito van der Zander
Description:
IsNaN crashes when give an invalid float
Steps to reproduce:
program temp;
{$mode objfpc}{$H+}
uses
Classes, SysUtils ,math
{ you can add units after this };
var n: extended;
data: array[0..4] of word=(1111, 32313, 46288, 32310, 65535);
{$IFDEF WINDOWS}{$R temp.rc}{$ENDIF}
begin
writeln(sizeof(n));
writeln(sizeof(data));
readln;
move(data,n,sizeof(n));
if IsNan(n) then
writeln('is nan')
else
writeln('isn''t nan');
readln;
end.
=>
10
10
An unhandled exception occurred at $0040153E :
EInvalidOp : Invalid floating point operation
$0040153E main, line 19 of temp.pas
Additional information:
This works:
... if n=nan then ...
and prints 'is nan'
Mantis conversion info:
- Mantis ID: 14351
- OS: XP
- Platform: Windows
- Version: 2.2.4
- Fixed in version: 2.6.0
- Fixed in revision: 17758 (#37b8b791)