NonStop Server for Java Programmer's Reference (NSJ 4.0+)
Table Of Contents

Floating-Point
Representation
Minimum Positive Decimal
Value
Maximum Decimal Value
TNS 1.7272337110188889e-77 1.15792089237316192e77
IEEE 4.94065645841246544e-324 1.79769313486231570e+308
How to Call TNS Floating-Point Functions from JNI
Code
This topic describes how to call a TNS floating-point function from an IEEE floating-point function.
When using TNS floating-point compiled functions in native code linked into java:
Do not call the Common Runtime Environment (CRE) functions with TNS floating-point values
because CRE functions are expecting IEEE floating-point values.
●
Do not pass floating-point values (float and double) across mixed float compilation units. When
passing or returning floating-point values between IEEE floating-point compiled functions and TNS
floating-point compiled functions, pass or return
A float as one of the 32-bit structures defined in $SYSTEM.SYSTEM.KFPCONVH
(NSK_float_ieee32 or NSK_float_tns32)
❍
A double as one of the 64-bit structures defined in $SYSTEM.SYSTEM.KFPCONVH
(NSK_float_ieee64 or NSK_float_tns64)
❍
●
You can call a native function that accepts or returns a TNS float or double value if you create an
intermediate function that sits between the IEEE floating-point compiled JNI method that the Java VM
calls and the native function that accepts or returns a TNS float or double. Either the JNI method
or the intermediate method can be responsible for calling one of the NSK_float_* procedures to
convert between IEEE and TNS floating-point formats.
The intermediate function:
Is compiled with TNS floating point.❍
Accepts float and double arguments as one of the special structures defined in the
$SYSTEM.SYSTEM.KFPCONVH file.
❍
Calls the TNS compiled native function passing TNS float or double arguments.❍
Converts any float or double return value to an IEEE floating-point value of the JNI caller
expects the value.
❍
Returns the float or double in one of the special structures defined in the
$SYSTEM.SYSTEM.KFPCONVH file.
❍
●
For an example, see the javahjni demonstration program.