mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 17:06:08 +02:00
* enable all applicable exceptions and perform both tests if one succeeds
git-svn-id: trunk@5136 -
This commit is contained in:
parent
3232e59810
commit
a200cae8af
@ -10,7 +10,10 @@ var
|
|||||||
c:Single;
|
c:Single;
|
||||||
temp_float:double;
|
temp_float:double;
|
||||||
temp_int:Integer;
|
temp_int:Integer;
|
||||||
|
notcaught: integer;
|
||||||
begin
|
begin
|
||||||
|
notcaught := 2;
|
||||||
|
SetExceptionMask(GetExceptionMask - [exOverflow,exUnderflow,exPrecision]);
|
||||||
try
|
try
|
||||||
{ cosh(800) =~ 1.36E+0347, this will fit in Extended but will
|
{ cosh(800) =~ 1.36E+0347, this will fit in Extended but will
|
||||||
not fit in Single or Double.
|
not fit in Single or Double.
|
||||||
@ -21,7 +24,7 @@ begin
|
|||||||
on E:Exception do
|
on E:Exception do
|
||||||
begin
|
begin
|
||||||
Writeln('Line "c:=..." raised ' +E.ClassName+ ': ' +E.Message);
|
Writeln('Line "c:=..." raised ' +E.ClassName+ ': ' +E.Message);
|
||||||
halt(0);
|
dec(notcaught);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -36,7 +39,10 @@ begin
|
|||||||
temp_int:=Round(temp_float);
|
temp_int:=Round(temp_float);
|
||||||
except
|
except
|
||||||
on E:Exception do
|
on E:Exception do
|
||||||
Writeln('Line "temp_int:=..." raised ' +E.ClassName+ ': ' +E.Message);
|
begin
|
||||||
|
Writeln('Line "temp_int:=..." raised ' +E.ClassName+ ': ' +E.Message);
|
||||||
|
dec(notcaught);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
halt(1);
|
halt(notcaught);
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user