News for hackers. Stuff that matters.
Re:Divisible by 7 (2016) by KMnO4 on Thursday May 20, 2021 @02:44PM (#27225355)
Here’s a cool video that shows how compilers optimize exponentiation[1].

It seems like a really simple problem on the surface (x^3? Just do xxx), but lots of smart people have thought hard about the best way to do it for any arbitrary exponent.

For example, x^15 only needs 5 multiplication instructions.

[1]: https://youtu.be/BfNlzdFa_a4

There are no comments on this comment yet.