Numerics, NaNs, IEEE 754 and C99
Grant Edwards
grante at visi.com
Thu Jun 15 12:46:58 EDT 2006
On 2006-06-15, Tim Peters <tim.peters at gmail.com> wrote:
> [Grant]
>> Am I remebering incorrectly?
>
> Mostly but not entirely.
>
>> Didn't the old fixed-width integers operate modulo-wordsize?
>
> Not in Python.
>
>> I distinctly remember having to rewrite a bunch of checksum code when
>> fixed-width integers went away.
>
> Best guess is that you're working on a 32-bit box, and remember this
> Python <= 2.2 behavior specific to the left shift operator:
>
>>>> 1 << 31
> -2147483648
>>>> 1 << 32
> 0
That's probably it.
I've also spent some time on/off fighting with 32-bit constants
that have the high-order bit set. You've got to jump through
hoops when you need to pass a value like 0xC0000000 to an
extension that demands a 32-bit value.
> + - * / on short ints always complained about overflow before
> int-long unification,
I was definitely mis-remembering things. I had to have been
the left shift that caused the problems.
--
Grant Edwards grante Yow! I'm CONTROLLED by
at the CIA!! EVERYONE is
visi.com controlled by the CIA!!
More information about the Python-list
mailing list