[Tutor] Can you get python to force a number to remain 32 bit
instead of autoconverting to type 'long'?
Kent Johnson
kent37 at tds.net
Fri Mar 11 12:08:05 CET 2005
R. Alan Monroe wrote:
> I tried to convert this pseudocode
>
> function IntNoise(32-bit integer: x)
> x = (x<<13) ^ x;
> return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0);
> end IntNoise function
>
> from this website
> http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
>
> to python. But it seems to rely on wraparound within the 32 bit int.
> Can you duplicate this behavior in python?
If you haven't figured this out I suggest you ask on comp.lang.python.
Kent
More information about the Tutor
mailing list