[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Am I misunderstanding random numbers?
- From: David Kastrup <dak@...>
- Date: Thu, 18 Mar 2010 10:02:43 +0100
Roberto Ierusalimschy <email@example.com> writes:
>> on my WinXP 32 bit box as well as an Ubuntu Karmic 32-bit box.
>> This makes it pretty clear that the conversion from double to int
>> is handling the overflow in an unexpected way. Knowing it will
>> saturate, having -2147483649 saturate to -2147483648 is
>> acceptable. However having 2147483649 saturate to the same value
>> is *surprising*.
> All values "saturate" to 0x80000000.
It seems that the positive ones should rather go towards 0x7fffffff.