Fixed-point constants—F and H
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.
- The nominal value can be a signed or unsigned (see 1 in Table 1) integer, fraction, or mixed number (see 2 Table 1) followed by a signed exponent (see 3 in Table 1). If a sign is not specified for either the
number or exponent, + is assumed. To generate unsigned data, precede
the numeric value with the letter
U
; signs are not allowed. - The exponent must lie within the permissible range (see 4 in Table 1). If an exponent modifier is also specified, the algebraic sum (see 5 in Table 1) of the exponent and the exponent modifier must lie within the permissible range.
Here are some examples of the range of values that can be assembled into fixed-point constants:
Length | Range of signed values that can be assembled | Range of unsigned values that can be assembled |
---|---|---|
8 | -263 to 263-1 | 0 to 264-1 |
4 | -231 to 231-1 | 0 to 232-1 |
2 | -215 to 215-1 | 0 to 216-1 |
1 | -27 to 27-1 | 0 to 28-1 |
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.
- If there is an exponent modifier, adjust the nominal value; that is, multiply the nominal value by the corresponding power of ten.
- Convert the resulting value from decimal to binary; if negative, this is in two's-complement form.
- If there is a scaling modifier, adjust the resulting binary number; that is, multiply by the corresponding power of two.
- Round the resulting number to a whole number.
- If there is a duplication factor, apply it to the resulting whole number.
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.
CONWRD DC 3F'658474'
Subfield | Value | Example | Result | |
---|---|---|---|---|
1. | Duplication factor | Allowed | ||
2. | Type | F and H | ||
3. | Type Extension | D permitted with type F | ||
4. | Program type | Allowed | ||
5. | Modifiers | |||
Length: | 1 to 8 (byte length) .1 to .64 (bit length) |
|||
Implicit length: (Length modifier not present) |
Doubleword: 8 bytes Fullword: 4 bytes Halfword: 2 bytes |
|||
Alignment: (Length modifier not present) |
Doubleword, fullword, or halfword |
|||
Scale: | F: -187 to +346 H: -187 to +346 |
|||
Exponent: | -85 to +75 4 | DC HE+75'2E-73'
5 |
value=2x102 | |
6. |
Nominal value Represented by: |
Decimal digits (0 to 9) |
Doubleword DC FD'-200'
1 DC FD'U7890123456' Fullword DC FS4'2.25' 2 DC FS4'U2.25' DC H'+200' DC HS4'.25' DC H'U200' DC HS4'U0.25' |
|
Enclosed by: | Apostrophes | |||
Exponent allowed: | Yes | Doubleword:DC FD'2E6' DC FD'U2E6' Fullword: DC F'2E6' 3 DC F'U2E6' DC H'2E+1' DC H'U2E+1' |
||
Number of values per operand: | Multiple | |||
Padding: | With sign bits at left | |||
Truncation of assembled value: | At left (error message issued) |
HALFCON DC HS6'-25.46'
FULLCON DC HS12'3.50E-2'
AH 7,=HS12'3.50E-2'
THREECON DC FS4'-10,25.3,U268435455'
TWOCONS DC F'123,445' Two constants
ONECON DC F'123 456' One constant