Guardian Procedure Calls Reference Manual
Examples
C Example
#include <kfpieee.h>
void Example(void) {
FP_IEEE_EXCEPTIONS_SET_( 0 ); /* clear exceptions */
DoComputation(); /* floating-point computation */
if( FP_IEEE_EXCEPTIONS_GET_() &
(FP_IEEE_INVALID|FP_IEEE_OVERFLOW|FP_IEEE_DIVBYZERO)
)
printf( "Trouble in computation! \n" );
}
TAL Example
proc DOCOMPUTATION; external;
?nolist
?source $system.system.kfpieee
?list
literal -- return codes for Example
NO_PROBLEM = 0D,
TROUBLE_IN_COMPUTATION = 1D;
int(32) proc Example;
begin
call FP_IEEE_EXCEPTIONS_SET_( 0D ); ! Clear exception bits
call DOCOMPUTATION; ! Routine to do IEEE fp computation
if( FP_IEEE_EXCEPTIONS_GET_ LAND ! test for exceptions
( FP_IEEE_INVALID LOR FP_IEEE_OVERFLOW LOR
FP_IEEE_DIVBYZERO )
) then return( TROUBLE_IN_COMPUTATION );
return( NO_PROBLEM );
FP_IEEE_EXCEPTIONS_GET_ Procedure 647