Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Fixed-point constants—F and H HLASM Language Reference SC26-4940-06 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Fixed-point constants let you introduce data that is in a form suitable for the arithmetic operations of the binary fixed-point machine instructions. The constants you define can also be automatically aligned to the correct doubleword, fullword, or halfword boundary for the instructions that refer to addresses on these boundaries (unless the NOALIGN option has been specified; see General information about constants). You can do algebraic operations using this type of constant because they can have positive or negative values. A fixed-point constant is written as a decimal number, which can
be followed by a decimal exponent. The format of the constant is as
follows:
Here are some examples of the range of values that can be assembled into fixed-point constants:
The range of values depends on the implicitly or explicitly specified length (if scaling is disregarded). If the value specified for a particular constant does not lie within the allowable range for a given length, the constant is not assembled, but flagged as an error. A fixed-point constant is assembled as follows:
The example statement generates 3 fullwords of data. The location
attribute of CONWRD is the address of the first byte
of the first word, and the length attribute is 4, the implied length
for a fullword fixed-point constant. The expression CONWRD+4 can
be used to address the second constant (second word) in the field.
In the following example, the DC statement generates a 2 byte field
containing a negative constant. Scaling has been specified in order
to reserve 6 bits for the fractional portion of the constant.
In the following example, the constant (3.50) is multiplied by
10 to the power -2 before being converted to its binary format. The
scale modifier reserves 12 bits for the fractional portion.
The same constant can be specified as a literal:
The final example specifies three constants. The scale modifier
requests 4 bits for the fractional portion of each constant. The
4 bits are provided whether or not the fraction exists.
Remember that commas separate operands. For readability, use spaces
instead, as shown in this example:
|
Copyright IBM Corporation 1990, 2014
|