HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Syntax of binary, decimal, and hexadecimal floating-point constants

HLASM Language Reference
SC26-4940-06

The syntax for coding binary, decimal, and hexadecimal floating-point constants is:
Figure 1. DC instruction syntax for floating point constants
Read syntax diagramSkip visual syntax diagram
>>-DC--+------------+--+-+-E-+--+---+-+--+--------------+------->
       '-dup_factor-'  | +-D-+  +-B-+ |  '-program_type-'   
                       | '-L-'  +-H-+ |                     
                       |        '-D-' |                     
                       '-LQ-----------'                     

                 .-,-----------------.   
                 V                   |   
>--+----------+----| nominal_value |-+-------------------------><
   '-modifier-'                          

nominal_value (no type extension)

      .- + -.                           
|--'--+-----+--value--+----------+--'---------------------------|
      '- - -'         '-exponent-'      

nominal_value (type extension B)

      .- + -.                       .-R4-------.      
|--'--+-----+--value--+----------+--+----------+--'-------------|
      '- - -'         '-exponent-'  '-R--+-1-+-'      
                                         +-5-+        
                                         +-6-+        
                                         '-7-'        

nominal_value (type extension H)

      .- + -.                       .-R1-------.      
|--'--+-----+--value--+----------+--+----------+--'-------------|
      '- - -'         '-exponent-'  '-R--+-4-+-'      
                                         +-5-+        
                                         +-6-+        
                                         '-7-'        

nominal_value (type extension D)

      .- + -.                       .-R8--------.      
|--'--+-----+--value--+----------+--+-----------+--'------------|
      '- - -'         '-exponent-'  '-R--+-9--+-'      
                                         +-10-+        
                                         +-11-+        
                                         +-12-+        
                                         +-13-+        
                                         +-14-+        
                                         '-15-'        

dup_factor
Causes the constant to be generated the number of times indicated by the factor.
type
Indicates that the constant is short, long, or extended floating point.
type extension
The type of conversion required to assemble the constant. Valid values are:
null
Hexadecimal floating-point constant which is converted using the conversion logic of rounding mode 1 and slightly less precise algorithms
B
Binary floating-point constant which is converted allowing all rounding modes
D
Decimal floating-point constant which is converted allowing all rounding modes
H
Hexadecimal floating-point constant which is converted allowing all rounding modes
Q
For extended-precision hexadecimal constants of type L, the Q-type extension requests alignment on a quadword boundary.
program_type
Assign a programmer determined 32 bit value to the symbol naming the DC instruction, if a symbol was present.
modifier
Describes the length, the scaling, and the exponent of the nominal_value. The minimum length of the 'H' hexadecimal constant is 12 bits. The minimum length in bits of the binary constant is:
9
Short floating-point constant
12
Long floating-point constant
16
Extended floating-point constant
This minimum length allows for the sign, exponent, the implied unit bit which is considered to be one for normalized numbers and zero for zeros and denormalized numbers.

The exponent modifier can be in the range from -231 to 231-1 if either B or H is specified as a type extension. The only valid length modifiers for decimal floating point constants are 4 bytes (short format), 8 bytes (long format), and 16 bytes (extended format).

nominal_value
Defines the value of the constant and can include the integer, fraction, or mixed number followed by an optional signed exponent and an optional explicit rounding mode.

The assembler imposes no limits on the exponent values that can be specified. The BFP architecture limits the actual values that can be represented; a warning message is issued whenever a specified value cannot be represented exactly.

The rounding mode identifies the rounding required when defining a floating-point constant. The valid values are those displayed in Figure 1.

Note: As binary floating-point does not support scaling, the scale modifier is ignored and a warning message issued if the scaling modifier is specified when defining a binary floating-point constant. The H type extension causes HLASM to use a different conversion algorithm for hexadecimal floating-point data. The results are correctly rounded for all values. Without the H type extension, some rare values are in error by one unit in the last place.

Conversion to binary floating-point

For decimal to binary floating-point conversion, the assembler conforms to ANSI/IEEE Std 754-1985, IEEE Standard for Binary Floating-Point Arithmetic, dated August 12, 1985, with the following differences: exception status flags are not provided and traps are not supported.

Conversion of values within the represented range is correctly rounded.

Conversion of values outside the represented range is as follows. If the resultant value before rounding is larger in magnitude than MAX (the maximum allowed value) as represented in the specified length, then, depending on the rounding mode, either MAX or infinity is generated, along with a warning message. If the resultant nonzero value is less than Dmin (the minimum allowed value) as represented in the specified length, then, depending on the rounding mode, either Dmin or zero is generated, along with a warning message.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014