Argument domain exception
DOMAIN
Argument singularity
SING
Overflow range exception
OVERFLOW
Underflow range exception
UNDERFLOW
Total loss of significance
TLOSS
Partial loss of significance
PLOSS
If your matherr() function returns a non-zero result, no exception message is
printed, and errno is not set.
program TestMatherr(output);
#include <math_p.h>
function matherr(var info: exception): integer;
begin
case info.kind of
DOMAIN: begin
{ change sqrt to return sqrt(-arg1), not NaN }
if substr(info.name^, 1, length('sqrt')) = 'sqrt' then begin
info.retval := sqrt(-info.arg1);
matherr := 1; { No exception message will be printed }
end;
end;
otherwise
matherr := 0;
end;
end;
begin
writeln('Error handling function');
writeln('sqrt(-1)= ', sqrt(-1));
end.
Math Libraries
11
241
Need help?
Do you have a question about the SunSoft Pascal 4.0 and is the answer not in the manual?
Questions and answers