Computer Hardware User's Guide
Floating-Point Formats
5-7
Data Formats and Floating-Point Operation
The following examples illustrate the range and precision of the ‘C32 short
floating-point format for external 16-bit data:
Most positive:
x
= (2–2
–8
) 2
127
= 3.3961775 10
38
Least positive
x
= 1 2
–127
= 5.8774717541 10
–39
Least negative:
x
= (–1–2
–8
) 2
–127
= –5.9004306 10
–39
Most negative:
x
= (–2 2
127
) = –3.4028236 10
38
Note that the floating-point instructions (such as LDF, MPYF, ADDF) and the
integer instructions (such as LDI, MPYI, ADDI) produce different results when
accessing the same memory location. The
integer
load instructions store the
value in the LSBs of the ‘C32’s registers. A bit field in the strobe control register
controls sign extension or zero fill of the MSBs of the integer value. On the other
hand, the
floating-point
load instructions store the value in the MSBs of the
‘C32’s registers. For example:
If AR1 = 4000h, R1 = 00 00000000h, the value stored at memory location
4000h is 0180h, and STRB0 is configured for a physical memory size and data
type size of 16 bits.
The result of: ADDI *AR1,R1 is R1 = 00 00000180h, while
The result of: ADDF *AR1,R1 is R1 = 01 C0000000h (= – 3.0), since
– 4.0 + 1.0 = – 3.0
5.3.3 Single-Precision Floating-Point Format
In the single-precision format, the floating-point number is represented by an
8-bit exponent field (
e
) and a 2s-complement 24-bit mantissa field (
man
) with
an implied most significant nonsign bit (see Figure 5–8).
Figure 5–8. Single-Precision Floating-Point Format
Exponent Sign Fraction
31 24 23 22 0
Mantissa
Operations are performed with an implied binary point between bits 23 and 22.
When the implied most significant nonsign bit is made explicit, it is located to
the immediate left of the binary point. The floating-point number
x
is given by
the following:
x
= 01.f × 2
e
if
s
= 0
x
= 10.f × 2
e
if
s
= 1
x
= 0 if
e
= –128