Float with your fingers
bbalk 1200006543 Visits (3426)
For many years, the only floating point representation on z/OS was hexadecimal float. This is a base 16 representation, but most of us have 10 fingers and most business applications want to perform decimal calculations.
The difference between these 2 bases leads to problems as exemplified by this code:
dcl f1 float dec(6);
dcl f2 fixed dec(5,3);
dcl f3 float dec(6);
f1 = 4;
f2 = f1 / 100e0;
put skip data( f2 );
f3 = 100 * f2;
put skip data( f3 );
This rather disconcerting result says that 100*(4/100) = 3.9 !
Similar problems exist with IEEE binary floating-point (which PL/I fully supports on z/OS).
However, IBM and Enterprise PL/I for z/OS also support the new IEEE decimal floating-point.
The accompanying hardware lets you perform float calculations as you would with your fingers: it is a true base 10 representation that exploits the speed of floating point computations as well as the availability (on z/OS) of 16 floating-point registers.
For more information about how to use decimal floating-point with PL/I, see the DFP suboption of the FLOAT compiler option.