Using IEEE floating-point

IEEE binary floating-point is provided primarily to enhance interoperability and portability between IBM System z and other platforms. It is anticipated that IEEE binary floating-point will be most commonly used for new and ported applications. Customers should not migrate existing applications that use hexadecimal floating-point to IEEE binary floating-point, unless there is a specific reason.

IBM does not suggest mixing Binary and Hexadecimal floating-point formats in an application. However, for applications which must handle both formats, the C/C++ runtime library does offer some support. Reference information for IEEE binary floating-point can also be found in z/OS XL C/C++ Language Reference.

You should use IEEE binary floating-point in the following situations: For more information about the IEEE format, refer to the IEEE 754-1985 IEEE Standard for Binary Floating-Point Arithmetic.

When you use IEEE binary floating-point, make sure that you are in the same rounding mode at compile time (specified by the ROUND(mode) option), as at run time. Entire compilation units will be compiled with the same rounding mode throughout the compilation. If you switch runtime rounding modes inside a function, your results may vary depending upon the optimization level used and other characteristics of your code; switch rounding mode inside functions with caution.

If you have existing data in hexadecimal floating-point (the original base 16 S/390® hexadecimal floating-point format), and have no need to communicate these data to platforms that do not support this format, there is no reason for you to change to IEEE binary floating-point format.

Applications that mix the two formats are not supported.

IEEE binary and decimal floating-point are fully supported in a CICS environment only if CICS TS Version 4 or later is in use.

For information on the C/C++ functions that support floating-point, see the functions listed in Table 1. For more information, see z/OS XL C/C++ Runtime Library Reference.

Table 1. C/C++ functions that support floating-point
absf() absl() acos() acosd32()
acosd64() acosd128() acosf() acosh()
acoshd32() acoshd64() acoshd128() acoshf()
acoshl() acosl() asin() asind32()
asind64() asind128() asinf() asinh()
asinhd32() asinhd64() asinhd128() asinhf()
asinhl() asinl() atan() atand32()
atand64() atand128() atanf() atanh()
atanhd32() atanhd64() atanhd128() atanhf()
atanhl() atanl() __atanpid32() __atanpid64()
__atanpid128() atan2() atan2d32() atan2d64()
atan2d128() atan2f() atan2l() cabs()
cabsf() cabsl() cacos() cacosf()
cacosh() cacoshf() cacoshl() cacosl()
carg() cargf() cargl() casin()
casinf() casinh() casinhf() casinhl()
casinl() catan() catanf() catanh()
catanhf() catanhl() catanl() cbrt()
cbrtd32() cbrtd64() cbrtd128() cbrtf()
cbrtl() ccos() ccosf() ccosh()
ccoshf() ccoshl() ccosl() ceil()
ceild32() ceild64() ceild128() ceilf()
ceill() cexp() cexpf() cexpl()
cimag() cimagf() cimagl() clog()
clogf() clogl() conj() conjf()
conjl() copysign() copysignd32() copysignd64()
copysignd128() copysignf() copysignl() cos()
cosd32() cosd64() cosd128() cosf()
cosh() coshd32() coshd64() coshd128()
coshf() coshl() cosl() __cospid32()
__cospid64() __cospid128() cotan() cotanf()
cotanl() cpow() cpowf() cpowl()
cproj() cprojf() cprojl() creal()
crealf() creall() csin() csinf()
csinh() csinhf() csinhl() csinl()
csqrt() csqrtf() csqrtl() ctan()
ctanf() ctanh() ctanhf() ctanhl()
ctanl() erf() erfc() erfcd32()
erfcd64() erfcd128() erfcf() erfcl()
erfd32() erfd64() erfd128() erff()
erfl() exp() expf() expl()
expm1() expm1d32() expm1d64() expm1d128()
expm1f() expm1l() exp2() exp2d32()
exp2d64() exp2d128() exp2f() exp2l()
expd32() expd64() expd128() fabs()
fabsd32() fabsd64() fabsd128() fabsf()
fabsl() fdim() fdimd32() fdimd64()
fdimd128() fdimf() fdiml() feclearexcept()
fe_dec_getround() fe_dec_setround() fegetenv() fegetexceptflag()
fegetround() feholdexcept() feraiseexcept() fesetenv()
fesetexceptflag() fesetround() fetestexcept() feupdateenv()
finite() floor() floord32() floord64()
floord128() floorf() floorl() fma
fmad32() fmad64() fmad128() fmaf()
fmal() fmax() fmaxd32() fmaxd64()
fmaxd128() fmaxf() fmaxl() fmin()
fmind32() fmind64() fmind128() fminf()
fminl() fmod() fmodd32() fmodd64()
fmodd128() fmodf() fmodl() fpclassify()
fp_read_rnd() fp_swap_rnd() frexp() frexpd32()
frexpd64() frexpd128() frexpf() frexpl()
gamma() gamma_r() hypot() hypotd32()
hypotd64() hypotd128() hypotf() hypotl()
ilogb() ilogbd32() ilogbd64() ilogbd128()
ilogbf() ilogbl() isfinite() isgreater()
isgreaterequal() isinf() isless() islessequal()
islessgreater() isnan() isnormal() isunordered()
jn() j0() j1() ldexp()
ldexpd32() ldexpd64() ldexpd128() ldexpf()
ldexpl() lgamma() lgammad32() lgammad64()
lgammad128() lgammaf() lgammal() lgamma_r()
llrint() llrintd32() llrintd64() llrintd128()
llrintf() llrintl() llround() llroundd32()
llroundd64() llroundd128() llroundf() llroundl()
log() logb() logbd32() logbd64()
logbd128() logbf() logbl() logf()
logl() log10() log10d32() log10d64()
log10d128() log10f() log10l() log1p()
log1pd32() log1pd64() log1pd128() log1pf()
log1pl() log2() log2d32() log2d64()
log2d128() log2f() log2l() logd32()
logd64() logd128() lrint() lrintd32()
lrintd64() lrintd128() lrintf() lrintl()
lround() lroundd32() lroundd64() lroundd128()
lroundf() lroundl() matherr() modf()
modff() modfl() modfd32() modfd64()
modfd128() nan() nand32() nand64()
nand128() nanf() nanl() nearbyint()
nearbyintd32() nearbyintd64() nearbyintd128() nearbyintf()
nearbyintl() nextafter() nextafterd32() nextafterd64()
nextafterd128() nextafterf() nextafterl() nexttoward()
nexttowardd32() nexttowardd64() nexttowardd128() nexttowardf()
nexttowardl() pow() powd32() powd64()
powd128() powf() powl() quantexpd32()
quantexpd64() quantexpd128() quantized32() quantized64()
quantized128() remainder() remainderd32() remainderd64()
remainderd128() remainderf() remainderl() remquo( )
__remquod32() __remquod64() __remquod128() remquof( )
remquol( ) rint() rintd32() rintd64()
rintd128() rintf() rintl() round()
roundd32() roundd64() roundd128() roundf()
roundl() samequantumd32() samequantumd64() samequantumd128()
scalb() scalbln() scalblnd32() scalblnd64()
scalblnd128() scalblnf() scalblnl() scalbn()
scalbnd32() scalbnd64() scalbnd128() scalbnf()
scalbnl() signbit() significand() sin()
sind32() sind64() sind128() sinf()
sinh() sinhd32() sinhd64() sinhd128()
sinhf() sinhl() sinl() __sinpid32()
__sinpid64() __sinpid128() sqrt() sqrtd32()
sqrtd64() sqrtd128() sqrtf() sqrtl()
tan() tand32() tand64() tand128()
tanf() tanhd32() tanhd64() tanhd128()
tanl() tanh() tanhf() tanhl()
tgamma() tgammad32() tgammad64() tgammad128()
tgammaf() tgammal() trunc() truncd32()
truncd64() truncd128() truncf() truncl()
yn() y0() y1()  
In z/OS Language Environment Vendor Interfaces, the topic on C/C++ Special Purpose Interfaces for IEEE Floating-Point provides information on the following functions.
Table 2. Special purpose C/C++ functions that support floating-point
__chkbfp() __fp_btoh() __fp_cast() __fp_htob()
__fp_level() __fp_read_rnd() __fp_setmode() __fp_swapmod()
__fp_swap_rnd() __fpc_rd() __fpc_rs() __fpc_rw()
__fpc_sm() __fpc_wr() __isBFP()