PEP 238 (revised)

Bengt Richter bokr at accessone.com
Mon Aug 6 05:42:24 EDT 2001


On Mon, 6 Aug 2001 01:41:15 -0400, "Tim Peters" <tim.one at home.com> wrote:

>[Bengt Richter]
>> UIAM, the way I read it, the only way you can get -0 from multiply
>> is as a result of extreme underflow denormalizing to zero. Others
>> give plain zero.  Of course, my intel pentium book is not the official
>> ieee754 spec.
>
>I can't guess what you're reading.  Here from the FMUL docs, in the IA-32
>Intel Architecture Software Developer's Manual, Volume 2: Instruction Set
>Reference, available at, e.g.,
>
Sorry about the guesswork, specifics below ;-)

>http://developer.intel.com/design/pentium4/manuals/245471.htm
>
>The last (byte-serving) link will get you to it quickly w/o enduring a 6.7MB
>download of the whole thing:
>
>    The sign of the result is always the exclusive-OR of the source
>    signs, even if one or more of the values being multiplied is 0 or
>    [a graphic for infinity].
>
>Same as the 754 rules.
>

I was looking at (hardcopy)
"Pentium Processor Family Developer's Manual
Volume 3: Achitecture and Programming Manual
1995"

On page 7-11, "Table 7-8. Zero Operands and Results (Contd.)"
 +------------------+---------------------+-----------------------+
 | Operation        |       Operands      |     Result            |
 +------------------+---------------------+-----------------------+
 |                  | ±0 x ±0             | 0                     |
 |                  | ±0 x ±X, ±X x ±0    | 0                     |
 |                  | +X x +Y, -X x -Y    | +0[1]                 |
 |                  | +X x -Y, -X x +Y    | -0[1]                 |
 +------------------+---------------------+-----------------------+
...
[1] When extreme underflow denormalizes the result to zero

I read the unadorned zeroes under results to mean the all-bits-zero
representing zero (which is also a positive zero).

(I hope '±' came through above, it's the symbol plus/minus, or
'+' over '-' in the same character symbol).

The instruction description for FMUL/FMULP/FIMUL on page 25-118
does not help resolve what "0" above means. It does not mention
the XOR sign rule.

I did follow with a second post containing

"My intel pentium book is plainly wrong, ignore previous doubt about *1.0 ;-)
 >>> math.atan2( 0.0,-0.0*1.0)
 3.1415926535897931
 >>> math.atan2( 0.0, 0.0*1.0)
 0.0"

Since plainly there is a different effect for -0.0*1.0 and 0.0*1.0,
both of which would seem to be covered by the second line in the table,
unless Python is interfering, which I wouldn't think.

It does that with python 1.5.2 on a '95-vintage P90 as well as on a more
recent 300mhzPII with python 2.1, so I'd say the book is unclear at best ;-/

Thanks for the intel URL. Hard copy can't compete up-to-datedness-wise.
Although I my browser/acrobat combo just wants to download the whole thing.
How do you get around that again?



More information about the Python-list mailing list