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.
I'd still be curious about any theories of storage.