[fpc-pascal] SIGFPE with SameValue()

Torsten Bonde Christiansen tc at epidata.info
Thu May 10 08:33:51 CEST 2012


Hi List.

I have discovered the following strange bug/problem.

Please check out the following program and tell me which part is right 
and which is wrong,
or perhaps what i'm doing wrong in this case.

program project1;

{$mode objfpc}{$H+}

uses
   math;

var
   a,b: extended;
begin
   if SameValue(1, MaxFloat) then  // This works?
     Writeln('Same')
   else
     WriteLn('Fail');

   a := 1;
   b := MaxFloat;
   if SameValue(a,b) then  // But this fails in SameValue with SIGFPE???
     Writeln('Same')
   else
     WriteLn('Fail');
end.

My setup :

Free Pascal Compiler version 2.6.0 (from: 
http://svn.freepascal.org/svn/fpc/tags/release_2_6_0)
Compiler Date      : 2012/01/19
Compiler CPU Target: x86_64

FPC Compiled with extra options "-g -gl -godwarfsets",

Kind regards,
Torsten Bonde Christiansen



More information about the fpc-pascal mailing list