5 ms·
I slightly wish the exponentiation function from the original article weren't the more complex "faster" version -- it's not really relevant to the article, and
by wcarss 8y ago
I slightly wish the exponentiation function from the original article weren't the more complex "faster" version -- it's not really relevant to the article, and it makes playing through the calls in your head just a little bit harder with a topic that already stretches your mind the first several times around. Regular exponentiation is a fine example without the added fun of working out why and how exactly this alternative form works.
That said, as always raganwald's stuff is a pleasant and informative read.
- braythwayt 8y agoGood feedback, thank you.
- paulddraper 8y agoI disagree. It nice to have a non-FizzBuzz problem. I.e. code that you could actually ship.
- anonytrary 8y agoI disagree. If you are writing shippable code in an article, it's because the article is about how to write shippable code. This article is not about that, so writing shippable code risks detracting from the main purpose of the article.
- braythwayt 8y agoExponentiation is almost never shippable code, most languages have an operator or standard library for that.
- paulddraper 8y agoFor certain ranges of numbers. But you could imagine this being part of, say, a "big integer" library. (Which C, C++, PHP, JS all lack.)
- braythwayt 8y agoIf you like esoteric, I learned this algorithm for obtaining the exponent of a 2x2 matrix, which amusingly enough is part of an interesting fibonaccialgorithm.
- ZeikJT 8y agoYou will hopefully have to edit out JS someday: https://github.com/tc39/proposal-bigint https://github.com/tc39/proposal-bigint https://developers.google.com/web/updates/2018/05/bigint https://developers.google.com/web/updates/2018/05/bigint