Calling TNS floating-point functions from JNI code
This section describes the procedure to call a TNS floating-point function from an IEEE floating-point function.
Perform the following when using TNS floating-point compiled functions in native code linked in the
java executable:
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 (
floatanddouble) 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 the following:A
doubleas one of the structures defined in$SYSTEM.SYSTEM.KFPCONVH(NSK_float_ieee64,NSK_float_tns64) or/usr/include/kfpconv.h.You can call a native function that accepts or returns a TNS
floatordoublevalue if you create an intermediate function. The intermediate function assembles between the IEEE floating-point compiled JNI method that the JVM calls and the native function that accepts or returns thefloatordoublevalue.Either the JNI method or 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
floatanddoublearguments as one of the special structures defined in the$SYSTEM.SYSTEM.KFPCONVHor/usr/include/kfpconv.hfile.Calls the TNS compiled native function passing TNS
floatordoublearguments.Converts any
floatordoublereturn value to an IEEE floating-point value, which the JNI caller expects.Returns the float or double in one of the special structures defined in the
$SYSTEM.SYSTEM.KFPCONVHor/usr/include/kfpconv.hfile.
For an example, see
nsjjni
Demonstration programs.

