Signed integer overflow undefined behavior or not?
John Colvin via Digitalmars-d
digitalmars-d at puremagic.com
Fri Nov 13 03:29:19 PST 2015
On Friday, 13 November 2015 at 10:20:53 UTC, Don wrote:
> On Friday, 13 November 2015 at 09:37:41 UTC, deadalnix wrote:
>> On Friday, 13 November 2015 at 09:33:51 UTC, John Colvin wrote:
>>> I don't understand what you think is so complicated about it?
>
>>> After arithmetic operations f is applied
>>> signed: f(v) = ((v + 2^(n-1)) mod (2^n - 1)) - 2^(n-1)
>
> Complicated in the sense that: when are those semantics useful?
> The answer of course, is, pretty much never. They are very
> bizarre.
They are 99% useless, I agree. The only good argument for them I
can think of is that it's a faithful mapping to the underlying
machine.
More information about the Digitalmars-d
mailing list