NAME f77_ieee_environment - mode, status, and signal handling for IEEE arithmetic SYNOPSIS #include <f77/f77_floatingpoint.h> integer*4 function ieee_flags(action,mode,in,out) character*(*) action, mode, in, out integer*4 function ieee_handler(action,exception,hdl) character*(*) action, exception sigfpe_handler_type hdl sigfpe_handler_type function sigfpe(code, hdl) sigfpe_code_type code sigfpe_handler_type hdl DESCRIPTION These subprograms provide modes and status required to fully exploit ANSI/IEEE Standard 754-1985 arithmetic in a FORTRAN program. They correspond closely to the functions ieee_flags(3M), ieee_handler(3M), and sigfpe(3). USAGE Example 1: Set rounding direction to round toward zero, unless the hardware does not support directed rounding modes: integer*4 ieeer character*1 mode, out, in ieeer = ieee_flags('set', 'direction', 'tozero', out) Example 2: Clear rounding direction to default, round toward nearest: character*1 out, in ieeer = ieee_flags('clear','direction', in, out) Example 3: Clear all accrued exception-occurred bits: character*16 out ieeer = ieee_flags('clear','exception','all',out) Example 4: If example 3 generates the overflow exception, detect the exception as follows: character*16 out ieeer = ieee_flags('get','exception','overflow', out) Example 5: A user-specified signal handler, with a main pro- gram to use it: external hand real r / 14.2 /, s / 0.0 / i = ieee_handler( 'set', 'division', hand ) t = r/s end integer function hand ( sig, sip, uap ) integer sig, address structure /fault/ integer address end structure structure /siginfo/ integer si_signo integer si_code integer si_errno record /fault/ fault end structure record /siginfo/ sip address = sip.fault.address write (*,10) address 10 format('Exception at hex address ', z8 ) end FILES include/f77/f77_floatingpoint.h libm.a SEE ALSO floatingpoint(3), signal(3), sigfpe(3), f77_floatingpoint(3F), ieee_flags(3M), ieee_handler(3M), and the Numerical Computation Guide
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |