242
Pascal 4.0 User’s Guide
11
libsunmath
Support for IEEE Modes and Exceptions
ieee_handler()
is used primarily to establish a signal handler for a
particular floating-point exception or group of exceptions.
The syntax of this function is described in the
ieee_handler
(3M) man page.
This following Pascal program demonstrates how to abort on division by zero.
ieee_flags()
is the recommended interface to:
•
Query or set rounding direction mode
•
Query or set rounding precision mode
•
Examine, clear, or set accrued exception flags
program TestIEEEHandler(output);
#include <math_p.h>
procedure DivisionHandler(
sig: integer;
sip: univ_ptr;
uap: univ_ptr);
begin
writeln('Bad data - division by zero.');
end; { DivisionHandler }
var
FpAction, FpException: string;
Zero: integer := 0;
begin
FpAction := 'set';
FpException := 'division';
writeln(ieee_handler(FpAction, FpException,
addr(DivisionHandler)));
writeln('1/0 = ', 1 / Zero);
writeln(ieee_handler(FpAction, FpException, SIGFPE_DEFAULT));
writeln('1/0 = ', 1 / Zero);
end.
Содержание SunSoft Pascal 4.0
Страница 14: ...xiv Pascal 4 0 User s Guide ...
Страница 16: ...xvi Pascal 4 0 User s Guide ...
Страница 30: ...6 Pascal 4 0 User s Guide 1 ...
Страница 160: ...136 Pascal 4 0 User s Guide 6 ...
Страница 268: ...244 Pascal 4 0 User s Guide 11 ...
Страница 320: ...296 Pascal 4 0 User s Guide B ...
Страница 331: ...Index 307 ...
Страница 333: ......