News for hackers. Stuff that matters.
Re:Swapping two Numbers without Temporary Variables by joe_the_user on Thursday March 24, 2022 @03:51PM (#30794570)
You could use unsigned ints, whose arithmetic wraps, to deal with the overflow.

I'd still be curious about any theories of storage.

Re:Swapping two Numbers without Temporary Variables by charcircuit on Thursday March 24, 2022 @04:16PM (#30794836)
Javacript doesn't have an unsigned int datatype. The numbers in the article were doubles.
Re:Swapping two Numbers without Temporary Variables by xxs on Thursday March 24, 2022 @04:25PM (#30794927)
you cant swap doubles like that though... b/c if any of them is a NaN or an infinity, it breaks down.

It works for integers (and pointers)

Re:Swapping two Numbers without Temporary Variables by charcircuit on Thursday March 24, 2022 @04:31PM (#30794995)
It also breaks due to rounding even if you don't have NaN or Inf.