NonStop Server for Java 6.0 Programmer's Reference
scope of this document. However, the javahjni demo shows an example of mixed modes. (For
information on demos, see “Demonstration Programs” (page 41).)
Linker Options
When building native libraries, you must use the following linker option:
–set floattype IEEE_float
How to Create Your Own Library of Native Code
The javahjni demonstration program that comes with NonStop Server for Java 6.0 shows how
to create a native library.
You can find the javahjni demonstration program in the install-dir/demo/javahjni
directory.
IEEE Floating-Point Implementation
Java uses IEEE floating-point arithmetic.
NOTE: In NonStop Server for Java 6.0, you cannot specify whether your Java classes use TNS
format.
Incompatibilities between the IEEE floating point and TNS floating-point representations might cause
loss of precision or accuracy when you convert between TNS float or double and IEEE float
or double.
This subsection explains the following subjects:
• “Floating-Point Values” (page 46)
• “Double-Precision Values” (page 46)
• “How to Call TNS Floating-Point Functions from JNI Code” (page 47)
Floating-Point Values
For floating-point values, TNS floating-point representations have larger exponents (and therefore,
a larger range) than IEEE floating-point representations, but they are less precise, as Table 5
(page 46) shows:
Table 5 Floating-Point Ranges
Maximum Decimal ValueMinimum Positive Decimal ValueFloating-Point Representation
1.1579208e77F1.7272337e-77FTNS
3.40282347e+38F1.40239846e-45FIEEE
Double-Precision Values
For double-precision values, TNS floating-point representations have smaller exponents (and
therefore, a smaller range) than IEEE floating-point representations, but they are more precise, as
Table 6 (page 46) shows:
Table 6 Double-Precision Ranges
Maximum Decimal ValueMinimum Positive Decimal ValueFloating-Point Representation
1.15792089237316192e771.7272337110188889e-77TNS
1.79769313486231570e+308/4.94065645841246544e-324IEEE
46 Implementation Specifics










