Using
this, we compute the maximum number storable at about
(100.30103)252» 1075.86» 9·1075.

We
may approximate the smallest positive number at 1.0 / (36·1075) or about 3.0·10–77.

The
following non–negative real numbers can be represented in this standard:

X = 0.0 and

3.0·10–77 < X < 9·1075.

Precision of
the Standards

The precision is dependent on the format used,
depending on the
number of bits used to represent the fraction.

We can summarize the precision for each format as
follows.

Single
precisionF = 241 part in 224.

Double
precisionF = 561 part in 256.

Extended
precisionF = 1201 part in 2120.

The first power of 2 is easily computed; we use
logarithms to approximate the others.224=
16,777,216 256» (100.30103)56 = 1016.85» 9·1016.2120» (100.30103)120 = 1036.12» 1.2·1036.

Summary

Format

Type

PositiveRange

Precision

Single Precision

E

3.0·10–77 < X < 9·1075

7 digits

Double Precision

D

3.0·10–77 < X < 9·1075

16 digits

Extended Precision

L

3.0·10–77 < X < 9·1075

36 digits

Examples of
Floating Point Format (Page 1)

Example 1: True 0

The number 0.0, called “true 0” by IBM, is stored as
all zeroes.

In single precision it would be0000 0000.

In double precision it would be0000 000000000000.

Example 2: Positive exponent and positive fraction.

The
decimal number is 128.50.The format
demands a representation in the
form X·16E, with
0.625 £ X < 1.0.

As
128 £ X < 256, the number
is converted to the form X·162.
Note that 128 = (1/2)·162 = (8/16)·162 , and 0.5 = (1/512)·162 = (8/4096)·162.
Hence, the value is 128.50 = (8/16 + 0/256 + 8/4096)·162; it is 162·0x0.808.

The
exponent value is 2, so the characteristic value is either 66 or 0x42 = 100
0010.The
first two hexadecimal digits in the eight digit representation are formed as
follows.

Field

Sign

Characteristic

Value

0

1

0

0

0

0

1

0

Hex value

4

2

The fractional part comprises
six hexadecimal digits, the first three of which are 808.
The number 128.50 is represented as 4280 8000.

Examples of
Floating Point Format (Page 2)

Example 3: Positive exponent and negative fraction.

The
decimal number is the negative number –128.50.At this point, we would normally
convert the magnitude of the number to hexadecimal representation.This number has the
same magnitude as the previous example, so we just copy the answer; it is 162·0x0.808.

We
now build the first two hexadecimal digits, noting that the sign bit is 1.

Field

Sign

Characteristic

Value

1

1

0

0

0

0

1

0

Hex value

C

2

The number 128.50 is
represented as C280 8000.
Note that we could have obtained this value just by adding 8 to the first hex
digit.

Examples of
Floating Point Format (Page 3)

Example 4: Negative exponent and positive fraction.

The
decimal number is 0.375.As a fraction,
this is 3/8 = 6/16.Put another way, it
is
160·0.375 = 160·(6/16).This is in the required
format X·16E, with
0.625 £ X < 1.0.

The
exponent value is 0, so the characteristic value is either 64 or 0x40 = 100
0000.The
first two hexadecimal digits in the eight digit representation are formed as
follows.

Field

Sign

Characteristic

Value

0

1

0

0

0

0

0

0

Hex value

4

0

The fractional part comprises six hexadecimal digits,
the first of which is a 6.
The number 0.375 is represented in single precision as4060 0000.
The number 0.375 is represented in double precision as4060 0000 00000000.

Examples of
Floating Point Format (Page 4)

Example 5: A Full Conversion
The number to be converted is 123.45.As
we have hinted, this is a non–terminator.

Example 5: A Full Conversion (Continued)
The exponent value is 2, so the characteristic value is either 66 or 0x42 = 100
0010.
The first two hexadecimal digits in the eight digit representation are formed
as follows.

Field

Sign

Characteristic

Value

0

1

0

0

0

0

1

0

Hex value

4

2

The number 123.45 is represented in single precision
as427B 3333.
The number is represented in double precision as427B 3333 33333333.

Example 6: One in “Reverse”We are given the single precision
representation of the number.It is 4110 0000.
What is the value of the number stored?Begin by examination of the first two hex digits.

Field

Sign

Characteristic

Value

0

1

0

0

0

0

0

1

Hex value

4

1

The sign bit is 0, so the
number is positive.The characteristic
is 0x41, so the exponent is
1 and the value may be represented by X·161.The fraction field is 100 000, so the value is 161·(1/16) = 1.0.

More On DC (Define Constant)

The general format of the DC statement is as follows.

Name

DC

dTLn
‘constant’

The name is an optional entry, but required if the program is to refer
to
the field by name.The standard column
positions apply here.

The declarative, DC, comes next in its standard
position.

The entry “dTLn” is read as
follows.

dis the optional
duplication factor.If not specified, it
defaults to 1.

Tis the required type specification; usually
either E and D. Note that the data actually
stored at the location does not need to beof this type, but it is a good
idea to restrict it to that type.

Lis an optional length of the data field in bytes.

The ‘constant’ entry is required and is used to
specify a value.
If the length attribute is omitted, the length is specified implicitly by this
entry.

Again, it is rarely desirable to specify a length for the E and D data
types.

DL3DS D‘0.0’Just another
storage allocation.Value is not
initialized.‘0.0’ is just a
comment.

Load Instructions

The
Load Instructions

The load instructions load a 64–bit floating point
register from either storage or
another floating–point register.The
valid register numbers are 0, 2, 4, or 6.

LE R1,D2(X2,B2)Load R1 single precision from memoryOperand 2 is an
aligned fullword;its address is a multiple of 4.

LD R1,D2(X2,B2)Load R1 double precision from memoryOperand 2 is an
aligned double word;its address is a
multiple of 8.

LER R1,R2Load the leftmost 32 bits of R1 from the leftmost 32
bits of R2.

LDR R1,R2Load the 64-bit register R1 from the 64-bit register
R2.

The first two instructions are type RX and the last two are type RR.

Type RX Floating–Point Loads

The opcodes for the two type RX instructions are as
follows:LEX‘78’LDX‘68’

Each is a four–byte instruction of the form OP R1,D2(X2,B2).

Type

Bytes

Operands

1

2

3

4

RX

4

R1,D2(X2,B2)

OP

R1 X2

B2 D2

D2D2

The first byte contains the 8–bit instruction code.

The second byte contains two 4–bit fields, each of which encodes a
register number.

R1
is the floating point register to be loaded.

X2 is the
general–purpose register used as an index register.

The third and fourth bytes contain an address in the standard
base/displacement
with index register format.

The load instructions do not set any condition code.

Type RR Floating–Point Loads

The opcodes for the two type RR instructions are as
follows:LERX‘38’LDRX‘28’

The object code format for these type RR instructions
follows the standard.
Each is a two–byte instruction of the form OP R1,R2.

Type

Bytes

Operands

RR

2

R1,R2

OP

R1
R2

The first byte contains the 8–bit instruction code.

The second byte contains two 4–bit fields, each of which
encodes a register number.

This instruction format is used to process data
between registers.

The Store Instructions

The
Store Instructions

There are two store instructions for storing either
the leftmost 32 bits or all 64 bits
of the 64 bit floating–point registers.Again, the valid register numbers are 0, 2, 4, or 6.

STE R1,D2(X2,B2)Store the 32 leftmost bits of register R1as a single precision
result into thealigned fullword
address.

STD R1,D2(X2,B2)Store the 64 bits of register R1 as adouble precision result
into the aligneddouble word address.

The opcodes for these two instructions are as follows:STEX‘70’STDX‘60’.

Each is a four–byte instruction of the form OP R1,D2(X2,B2).

Type

Bytes

Operands

1

2

3

4

RX

4

R1,D2(X2,B2)

OP

R1 X2

B2 D2

D2D2

The
first byte contains the 8–bit instruction code.
The second byte contains two 4–bit fields, each of which encodes a register
number.
The third and fourth bytes contain an address in the standard base/displacement
with
index register format.

Sample Code

LOAD1 LE 0,FL1LOAD FP REG
0 FROM ADDRESS FL1

LOAD2LD 2,FL2LOAD DOUBLE
PRECISION

LOAD3LER 4,0COPY SINGLE PRECISION INTO FP REG 4

LOAD4LDR 6,2COPY DOUBLE PRECISION INTO FP REG 6

STORE1STE 6,FL3STORE THE
SINGLE PRECISION INTO FL3

STORE2STD 6,FL4STORE
DOUBLE PRECISION INTO FL4

FL1DCE‘123.45’A SINGLE PRECISION FLOATING POINT

CONSTANT.ADDRESS IS
MULTIPLE OF 4.

FL2DCD‘45678.90’ A DOUBLE PRECISION
FLOATING POINTCONSTANT.ADDRESS IS MULTIPLE OF 8

The DS E and DC E declaratives align the address of the memory area as
a multiple of 4.

The DS D and DC D declaratives align the address of the memory area as
a multiple of 8.

Addition and Subtraction

There are four distinct addition instructions and four
distinct subtraction instructions
for normalized floating–point numbers.These instructions are as follows:

Mnemonic

Operation

Opcode

Operand
Format

AE

Add
single precision

7A

R1,D2(X2,B2)

AD

Add
double precision

6A

R1,D2(X2,B2)

AER

Add
register single precision

3A

R1,R2

ADR

Add
register double precision

2A

R1,R2

SE

Subtract
single precision

7B

R1,D2(X2,B2)

SD

Subtract
double precision

6B

R1,D2(X2,B2)

SER

Subtract
register single precision

3B

R1,R2

SDR

Subtract
register double precision

2B

R1,R2

Subtraction
functions by changing the sign of the second operand and then performing
an addition.

The first
step in each is ensuring that the characteristics of both operands are
equal.If
unequal, the field with the smaller characteristic is adjusted by shifting the
fraction to
the right and incrementing the characteristic by 1 until the characteristics
are equal.

Addition Example: Adjusting the Characteristic

Here is an
example of adjusting the characteristic.

CharacteristicFraction4129000=41290004012000=4101200412A200

Suppose that the fraction overflows.If that happens, the fraction is shifted
right by one
hexadecimal digit and the characteristic is incremented by 1.This last operation is
called normalization, in that it returns the result to the expected normal
form.

In each,
the first operand specifies a register that stores the multiplicand and,
after the multiplication, stores the product.

The operation normalizes the product, which in all
cases is a double–precision result.

Sample code segment

M1LE2,MULTCAN1LOAD FIRS MULTIPLICAND

ME2,MULTIPLIERDO A MULTIPLICATION

LE4,MULTCAN2LOAD ANOTHER VALUE

MER4,2REG 4 GETS THE PROCUCT OFTHE THREE
VALUES.

Division

There are four distinct floating–point division operations.

Mnemonic

Action

Opcode

Operands

DE

Divide
single precision

7D

R1,D2(X2,B2)

DD

Divide
double precision

6D

R1,D2(X2,B2)

DER

Divide
single (register)

3D

R1,R2

DDR

Divide
double (register)

2D

R1,R2

In
each, the first operand specifies a register that stores the dividend and,
after the division, stores the quotient.There is no remainder.

The
operation normalizes the quotient, which in all cases is a double–precision
result.

Sample code segment

D2LD2,DIVIDND1LOAD FIRST DIVIDEND

DD2,DIVSORFIRST DIVISION

LD4,DIVIDND2LOAD SECOND DIVIDEND

DDR4,2ANOTHER DIVISION

DIVIDND2 / (DIVIDND1 / DIVSOR)or (DIVIDND2 *
DIVSOR)/ DIVIDND1

Comparison

There are four distinct floating–point division
comparison operations.

Mnemonic

Action

Opcode

Operands

CE

Compare
single precision

79

R1,D2(X2,B2)

CD

Compare
double precision

69

R1,D2(X2,B2)

CER

Compare
single (register)

39

R1,R2

CDR

Compare
double (register)

29

R1,R2

In
each, the comparison sets the condition codes as would be expected for
comparisons in the other
formats.Each operation proceeds as a
modified subtraction.The characteristic
fields of the two
operands are checked, and the smaller exponent is incremented while right
shifting its fraction
(denormalizing the number, but preserving its value) before the comparison.

If
both operands have fractions that are zero (all bits in the field are 0), the
result is
declared to be equal without consideration of either the exponent or the sign.

The
single precision operations compare only the leftmost 32 bits in each value.