Satan loves extended precision

James R. Reinders uunet!SSD.intel.com!reinders
Tue Jan 24 15:06:50 PST 1995


> On chips like the 486DX that have internal extended precision registers,
> is it possible to calculate the single or double precision result of a
> single operation by performing the operation in extended precision, then
> storing the result to memory?  Rounding a result to 80 bits, then to
> 53 bits can produce a different answer than rounding directly to 53 bits.

The Intel 8087, 80187, 80287, 80387, i486, and Pentium processors all
have a "precision control" which allows you to taylor the behavior of
you program to your needs.

Using the preciison control, you can choose to let intermediate
results be maintained in 80-bit format, or have the intermediate
significand rounded to 53 bit (IEEE double precision) or to IEEE
single precision.

Here is the assembly language code (written for a UNIX assembler,
the mnemonics may vary - and the operands will be REVERSED for
a DOS assembler) to set the precision mode:

        movl      $-60545, %eax  // 80 bit mode
        pushl     %eax
        fldcw     (%esp)
        popl      %eax

        movl      $-60801, %eax  // 64 bit mode
        pushl     %eax
        fldcw     (%esp)
        popl      %eax

        movl      $-61313, %eax  // 32 bit mode
        pushl     %eax
        fldcw     (%esp)
        popl      %eax

I hope this helps.  A good guide to these found in the "Intel
Pentium(TM) Processor User's Manual, Volume 3: Architecture and
Programming Manual."  It covers the IEEE compatibility, rounding
modes, exception models, precision control, etc.

I do not know the price, but the order number is 1-800-548-4725 in the
U.S.  Outside the U.S., you can look up the number of your nearest
Intel Sale Office [or drop me a note and I'll look it up in my phone
book here.]

I hope this helps.

- james

:: James R. Reinders                 reindersassd.intel.com ::
:: Intel Supercomputer Systems, M/S C06-01                  ::
i486 and Pentium are Intel trademarks





More information about the Numeric-interest mailing list