Texas-instruments TMS320C3x Uživatelský manuál Strana 146

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 757
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 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.
Zobrazit stránku 145
1 2 ... 141 142 143 144 145 146 147 148 149 150 151 ... 756 757

Komentáře k této Příručce

Žádné komentáře