mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 03:00:42 +02:00
* 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:
parent
fffc317759
commit
dcb46051c4
@ -70,6 +70,7 @@ const
|
|||||||
DP1 = 7.85398125648498535156E-1;
|
DP1 = 7.85398125648498535156E-1;
|
||||||
DP2 = 3.77489470793079817668E-8;
|
DP2 = 3.77489470793079817668E-8;
|
||||||
DP3 = 2.69515142907905952645E-15;
|
DP3 = 2.69515142907905952645E-15;
|
||||||
|
zero: double = 0;
|
||||||
|
|
||||||
{$if not defined(FPC_SYSTEM_HAS_SIN) or not defined(FPC_SYSTEM_HAS_COS)}
|
{$if not defined(FPC_SYSTEM_HAS_SIN) or not defined(FPC_SYSTEM_HAS_COS)}
|
||||||
const sincof : array[0..5] of Real = (
|
const sincof : array[0..5] of Real = (
|
||||||
@ -121,6 +122,16 @@ Begin
|
|||||||
HandleError(207);
|
HandleError(207);
|
||||||
end;
|
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}
|
{$ifdef SUPPORT_DOUBLE}
|
||||||
|
|
||||||
{$ifndef FPC_HAS_FLOAT64HIGH}
|
{$ifndef FPC_HAS_FLOAT64HIGH}
|
||||||
@ -181,9 +192,9 @@ type
|
|||||||
begin
|
begin
|
||||||
if aExp>=$43e then
|
if aExp>=$43e then
|
||||||
begin
|
begin
|
||||||
if (a.high<>$C3E00000) or (a.low<>0) then
|
if (a.high<>longint($C3E00000)) or (a.low<>0) then
|
||||||
begin
|
begin
|
||||||
float_raise(float_flag_invalid);
|
fpe_helper(zero/zero);
|
||||||
if (longint(a.high)>=0) or ((aExp=$7FF) and
|
if (longint(a.high)>=0) or ((aExp=$7FF) and
|
||||||
(aSig<>$0010000000000000 )) then
|
(aSig<>$0010000000000000 )) then
|
||||||
begin
|
begin
|
||||||
@ -231,7 +242,7 @@ type
|
|||||||
Begin
|
Begin
|
||||||
if ( a <> Float32($DF000000) ) then
|
if ( a <> Float32($DF000000) ) then
|
||||||
Begin
|
Begin
|
||||||
float_raise( float_flag_invalid );
|
fpe_helper( zero/zero );
|
||||||
if ( (longint(a)>=0) or ( ( aExp = $FF ) and (aSig<>0) ) ) then
|
if ( (longint(a)>=0) or ( ( aExp = $FF ) and (aSig<>0) ) ) then
|
||||||
Begin
|
Begin
|
||||||
result:=$7fffffffffffffff;
|
result:=$7fffffffffffffff;
|
||||||
@ -969,11 +980,10 @@ type
|
|||||||
begin
|
begin
|
||||||
if( d <= 0.0 ) then
|
if( d <= 0.0 ) then
|
||||||
begin
|
begin
|
||||||
if d < 0.0 then begin
|
if d < 0.0 then
|
||||||
float_raise(float_flag_invalid);
|
result:=(d-d)/zero
|
||||||
d := 0/0;
|
else
|
||||||
end;
|
result := 0.0;
|
||||||
result := 0.0;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user