Hacker News new | past | comments | ask | show | jobs | submit login

You might be interested to know about mod 2^m -1. Look at these numbers:

32640, 15420, 39321, 43690

In binary they look like: 1111111100000000, 0111100001111000, 0011001100110011, 0101010101010101

How cute. They are like little one bit precision sine waves.

I assure you that these numbers multiplied by each other mod (2^16 -1) are all equal to zero. When multiplied by themselves they shift position. test it for yourself. Long story short, in the field of mod 2^16 -1, 2^x works just like e^pi i, these numbers function just like sine and cosine, and you can even make linear superposition out of them and use them as a basis to decompose other ints into "frequency space."

Even better, the number i is represented here. There's a number int this modulo system which squares to 1111111111111110 (aka -1). Once you see it, you can implement fast sine and cosine directly through 2^{ix} = cos(x) + i sin(x).

Cool right.

Have fun.




Whoa that is awesome. You and Sesse__ are really inspiring me to get a VST dev environment set up again this weekend.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: