Guardian Procedure Calls Reference Manual
The following table indicates which procedures can produce which errors:
Was_NaNWas_ InfIn-exactUnder-flowOver-flowConversion
YESYESYESYESYESIEEE64 to TNS64
YESYESYESYESYESIEEE64 to TNS32
YESYESYESNOYESIEEE32 to TNS32
NOTE: For IEEE32-to-TNS32 conversion, overflow can occur only if the input is infinite or a NaN.
Considerations
• These procedures are usable by both TNS floating-point-format callers and IEEE
floating-point-format callers.
• The procedures do not require the data to be aligned on four-byte or eight-byte boundaries.
Shared2 (two-byte) alignment is sufficient.
• The NonStop operating system uses big-endian data formats for all data. For data interchange
with little-endian computers using IEEE floating point (such as Alpha processors and Intel®
processors), you must reverse the order of bytes in the data.
• Four data structures are declared for containers of data in the four supported formats:
For 64-bit IEEE floating-point numbersNSK_float_ieee64
For 64-bit TNS floating-point numbersNSK_float_tns64
For 32-bit IEEE floating-point numbersNSK_float_ieee32
For 32-bit TNS floating-point numbersNSK_float_tns32
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;
876 Guardian Procedure Calls (N)