* Get rid of last softfloat dependencies in genmath.inc. Replaced remaining calls to float_raise with expressions which generate appropriate floating-point exceptions at runtime. This is probably somewhat slower on actual softfloat targets, but the change only affects exceptional control flow, so not a significant issue.

git-svn-id: trunk@27198 -
This commit is contained in:
sergei 2014-03-20 11:04:00 +00:00
parent fffc317759
commit dcb46051c4

View File

@ -70,6 +70,7 @@ const
DP1 = 7.85398125648498535156E-1;
DP2 = 3.77489470793079817668E-8;
DP3 = 2.69515142907905952645E-15;
zero: double = 0;
{$if not defined(FPC_SYSTEM_HAS_SIN) or not defined(FPC_SYSTEM_HAS_COS)}
const sincof : array[0..5] of Real = (
@ -121,6 +122,16 @@ Begin
HandleError(207);
end;
{ This function does nothing, but its argument is expected to be an expression
which causes FPE when calculated. If exception is masked, it just returns true,
allowing to use it in expressions. }
function fpe_helper(x: valreal): boolean;
begin
result:=true;
end;
{$ifdef SUPPORT_DOUBLE}
{$ifndef FPC_HAS_FLOAT64HIGH}
@ -181,9 +192,9 @@ type
begin
if aExp>=$43e then
begin
if (a.high<>$C3E00000) or (a.low<>0) then
if (a.high<>longint($C3E00000)) or (a.low<>0) then
begin
float_raise(float_flag_invalid);
fpe_helper(zero/zero);
if (longint(a.high)>=0) or ((aExp=$7FF) and
(aSig<>$0010000000000000 )) then
begin
@ -231,7 +242,7 @@ type
Begin
if ( a <> Float32($DF000000) ) then
Begin
float_raise( float_flag_invalid );
fpe_helper( zero/zero );
if ( (longint(a)>=0) or ( ( aExp = $FF ) and (aSig<>0) ) ) then
Begin
result:=$7fffffffffffffff;
@ -969,11 +980,10 @@ type
begin
if( d <= 0.0 ) then
begin
if d < 0.0 then begin
float_raise(float_flag_invalid);
d := 0/0;
end;
result := 0.0;
if d < 0.0 then
result:=(d-d)/zero
else
result := 0.0;
end
else
begin