Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (N)
Guardian Procedure Calls Reference Manual—522629-013
10-48
NSK_FLOAT_IEEE32_TO_TNS32_ Procedure
NSK_FLOAT_IEEE64_TO_TNS32_ Procedure
Examples
C Example
#include <kfpconv.h>
#include <stdio.h>
void example1(void) {
NSK_float_ieee64 before;
NSK_float_tns32 after;
ReadIEEE64(&before); /* read in value to convert */
if( NSK_FLOAT_IEEE64_TO_TNS32_( &before, &after )
& NSK_FLOAT_TNS_OVERFLOW )
printf( "Overflow!\n" );
WriteTNS32(&after); /* write out result */
}
TAL Example
?nolist
?source $system.system.kfpconv
?list
int(32) proc example2( x );
real(64) .ext x; -- IEEE64 before, TNS64 after
begin
int(32) error;
int .ext before ( NSK_float_ieee64 ) = x;
int .ext after ( NSK_float_tns64 ) = x;
error := NSK_FLOAT_IEEE64_TO_TNS64_( before, after );
if ($int(error) LAND $int(NSK_FLOAT_TNS_OVERFLOW)) then
return( 2D ); -- 2 for overflow (out of range)
return( 0D ); -- 0 for no errors
end;