Hok's Macromedia Flash Blog

macromedia flash actionscript scripting, php, remoting, webservices, c#, javascript

Ads

Search

Funny Math

I have just found an older thread in ultrashock
math-forum, really cool how many ways possible to
toggle a variable between 1 and 2, hehe: k = 3-kk = (k==1)?2:1;if(!(k--)) k=2;k = (k%=2)+1;k = k%2+1;k = !(k-1) + 1;k = 1 + sin(asin(k-1) + PI/2);k = pow(2,2-k);(k-1)? (k >>= 1) : (k <<= 1);k = (Math.log(k)) ? --k : ++k;k = (((k&1)<<2)|k)>>1;k = (Math.sqrt(--k)) + 2*(!k);k = 1-(k--*--k);k = 1+!(--k/k);k = !(++k%--k)+1;k = (k>>1|k<<1)&3;k = 2/k;k = Math.abs(k*3-5);k = Math.ceil(Math.cos(k))+1;k = Math.round(2.4-k/2);k = 2-Math.floor(Math.tan(--k));k = Math.abs((k^2)-1);

Posted by hOk at April 5, 2003 04:28 PM

Comments (2)

wow! very cool! surprise to many ways possible.
first way i've thought is absolutely k = (k==1)?2:1; :)

Posted by jepezi at May 1, 2003 06:43 AM

Wow, I just surfed into your blog and found a post about me. :D Glad you liked the maths.

Great blog, btw.

Posted by basta at May 11, 2003 11:45 PM


Name:


Email Address:


URL:


Comments:



You can use <code>code that should be highlightned</code> to highlight code!
Optionally you can use the attribut language="php|perl|java" within the code tag, otherwise
actionscript-highlightning will be used.

New Place