>>>
>>>Of course... that formula you gave has a risk of numeric overflow...
>>
>>The formula I gave was
>>
>>N = -N
>>
>>
>>I find one exception where the negative value results in the same value.
>>
>>I'm not convinced overflow comes in
>>
>>(1) the value is -2^31 and (2) you force the value to be contained in a 4 byte signed integer
>>
>>n = 0x80000000
>>?'n = ', n
>>?'-n = ', -n
>>n = bitor(n, 0)
>>?'bitor = ', n
>>x = -n
>>?'-n = ', x
>>?'abs', abs(n)
>>
>>? ' x == -x ', x == -x
>>
>>
>>
>>Update - and yes - I know why
>
>Sorry. Wasn't paying attention to who I was responding to. I should've made it clear that I was meaning the formula as given by the original poster:
>
N = N - 2*N
>was the one with the problem.
I wouldn't mind - happens to all of us
>
>Think I'll need more caffeine (opens fresh can of coffee -- takes spoon and begins munching away -- too impatient to wait for brewing batch -- besides, why dilute it with water?)
Gregory