Texas-instruments TMS320C3x Manual de usuario Pagina 146

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 757
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 145
Floating-Point to Integer Conversion (FIX Instruction)
5-41
Data Formats and Floating-Point Operation
5.9 Floating-Point to Integer Conversion (FIX Instruction)
Using the FIX instruction, you can convert an extended-precision floating-
point number to a single-precision integer in a single cycle. The floating-point
to integer conversion of the value
x
is referred to here as fix(
x
). The conversion
does not overflow if
a
, the number to be converted, is in the range:
–2
31
α 2
31
– 1
First, you must be certain that
α(
exp
) 30
If these bounds are not met, an overflow occurs. If an overflow occurs in the
positive direction, the output is the most positive integer. If an overflow occurs
in the negative direction, the output is the most negative integer. If α(
exp
) is
within the valid range, then α(
man
), with implied bit included, is sign-extended
and right-shifted (rs) by the amount
rs = 31 – α(
exp
)
This right shift (rs) shifts out those bits corresponding to the fractional part of
the mantissa. For example:
If 0 × < 1, then fix(
x
) = 0
If –1 × < 0, then fix(
x
) = –1
Figure 5–20 shows the flowchart for the floating-point-to-integer conversion.
Vista de pagina 145
1 2 ... 141 142 143 144 145 146 147 148 149 150 151 ... 756 757

Comentarios a estos manuales

Sin comentarios