Texas Instruments TMS320C3x User Manual

Page 114

Advertising
background image

Floating-Point Formats

5-9

Data Formats and Floating-Point Operation

The following examples illustrate the range and precision of the extended-
precision floating-point format:

Most positive:

x = (2 – 2

– 23

)

Ч

2

127

= 3.4028234

Ч

10

38

Least positive:

x = 1

Ч

2

–127

= 5.8774717541

Ч

10

38

Least negative:

x = (–1–2

–31

)

Ч

2

–127

= – 5.8774717569

Ч

10

–39

Most negative:

x = – 2

Ч

2

127

= – 3.4028236691

Ч

10

38

5.3.5

Determining the Decimal Equivalent of a TMS320C3x Floating-Point Format

To convert a ‘C3x floating-point number to its decimal equivalent, follow these
steps:

Step 1: Convert the exponent field to its decimal representation.

The exponent field is a 2s-complement number. To convert a 2s-
complement number, look at the MSB. If it is 0, then convert the
binary number to a decimal number. If the MSB is 1, then comple-
ment the binary number, add 1 to the result, and then convert this
binary number to a decimal number.

Step 2: Convert the mantissa field to its decimal representation.

The mantissa field is represented as a sign-mantissa number with an
implied 1 and an implied binary point between the sign bit and the frac-
tion field. If the sign bit is cleared (

s = 0), form the mantissa by writing

01, and appending the bits in the fraction field after the binary point.
For example, if

f = 10100000000

2

, then

man = 01.10100000000

2

:

s

Fraction

0

1

0

1

0

0

0

0

0

0

0

0

Rewrite the mantissa as:

Mantissa

0

1

.

1

0

1

0

0

0

0

0

0

0

0

If the sign bit is set (

s = 1), form the mantissa by writing 10 and appending the

bits in the fraction field after the binary point. For example, if

f = 10100000000

2

,

then

man = 10.10100000000

2

.

s

Fraction

1

1

0

1

0

0

0

0

0

0

0

0

Advertising