g two variables without using a temporary
variable
@Wladimir:
Can you kindly explain the overflow and underflow you mentioned.
Thanks
Supraja J
On Fri, Jun 10, 2011 at 9:58 PM, Wladimir Tavares wrote:
> Swapping two variables without using a temporary variable using the + and
> -:
>
&g
Have you tested your claim regarding overflow/underflow and proved it
is indeed a problem, or you just thought that it won't work? Using
two's complement, it should still work.
On Friday, June 10, 2011, Wladimir Tavares wrote:
> Swapping two variables without using a temporary variable using the
@sunny... yeah sorry, m stupid..:)
thanx
On Tue, Jun 14, 2011 at 10:52 AM, sunny agrawal wrote:
> @tech rascal
>
> 10 = 01010
> 20 = 10100
> --
> xor = 0
> = 30
> why r u getting 1 ??
>
>
> On Tue, Jun 14, 2011 at 2:28 AM, Supraja Jayakumar <
> suprajasank...@gmail.com> wrote:
@tech rascal
10 = 01010
20 = 10100
--
xor = 0
= 30
why r u getting 1 ??
On Tue, Jun 14, 2011 at 2:28 AM, Supraja Jayakumar wrote:
> @Wladimir:
> Can you kindly explain the overflow and underflow you mentioned.
>
> Thanks
> Supraja J
>
> On Fri, Jun 10, 2011 at 9:58 PM, Wladi
@Wladimir:
Can you kindly explain the overflow and underflow you mentioned.
Thanks
Supraja J
On Fri, Jun 10, 2011 at 9:58 PM, Wladimir Tavares wrote:
> Swapping two variables without using a temporary variable using the + and
> -:
>
> x = a;
> y = b;
>
> x = x + y / / x = a + b;
> y = x - y / /
Swapping two variables without using a temporary variable using the + and -:
x = a;
y = b;
x = x + y / / x = a + b;
y = x - y / / y = a + b-b = a;
x = x - y / / x = a + b-a = b;
y = b;
x = a;
Problems with this approach:
1) It can cause overflow in the operation (+)
2) It can cause underflow on