Skip to content

Commit 31b244b

Browse files
committed
Reimplemented MaskFPUExceptions pyscripter#57
1 parent e660759 commit 31b244b

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

PythonForDelphi/Components/Sources/Core/PythonEngine.pas

+11-13
Original file line numberDiff line numberDiff line change
@@ -3168,7 +3168,7 @@ procedure MaskFPUExceptions(ExceptionsMasked : boolean;
31683168
implementation
31693169

31703170
{$IFDEF MSWINDOWS}
3171-
uses Registry;
3171+
uses Math, Registry;
31723172
{$ENDIF}
31733173

31743174

@@ -9732,19 +9732,17 @@ function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean;
97329732
procedure MaskFPUExceptions(ExceptionsMasked : boolean;
97339733
MatchPythonPrecision : Boolean);
97349734
begin
9735-
{$IFNDEF CPUARM}
9736-
if MatchPythonPrecision then begin
9737-
if ExceptionsMasked then
9738-
Set8087CW($1232 or $3F)
9739-
else
9740-
Set8087CW($1232);
9741-
end else begin
9742-
if ExceptionsMasked then
9743-
Set8087CW($1332 or $3F)
9735+
if ExceptionsMasked then
9736+
SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide,
9737+
exOverflow, exUnderflow, exPrecision])
9738+
else
9739+
SetExceptionMask([exDenormalized, exUnderflow, exPrecision]);
9740+
{$IFNDEF NEXTGEN}
9741+
if MatchPythonPrecision then
9742+
SetPrecisionMode(pmDouble)
97449743
else
9745-
Set8087CW($1332);
9746-
end;
9747-
{$ENDIF}
9744+
SetPrecisionMode(pmExtended);
9745+
{$ENDIF !NEXTGEN}
97489746
end;
97499747

97509748
{$IFDEF MSWINDOWS}

0 commit comments

Comments
 (0)