Test fpu exception reset

This commit is contained in:
pierre 2000-05-09 20:31:58 +00:00
parent 3cae2ee1a5
commit 023e8976a4

29
tests/test/testfpu2.pp Normal file
View File

@ -0,0 +1,29 @@
{$mode objfpc}
program test_fpu_excpetions;
uses
sysutils;
function mysqrt(x : real) : real;
begin
try
mysqrt:=sqrt(x);
except
on e : exception do
mysqrt:=0;
end;
end;
var
x, y,z : real;
begin
x:=6.5;
y:=5.76;
z:=3.1;
Writeln('Testing mysqrt (x) = sqrt(x) if x >= 0');
Writeln(' = 0 if x < 0');
Writeln(' 6.5+5.76*mysqrt(3.1) = ',x+y*mysqrt(z):0:6);
Writeln(' 6.5+5.76*mysqrt(-3.1) = ',x+y*mysqrt(-z):0:6);
end.