4 ms·
I don't want to take away from his brilliance, but generally Taylor approximations perform far worse than the standard library implementations. It's also the fi
by BeetleB 2y ago
I don't want to take away from his brilliance, but generally Taylor approximations perform far worse than the standard library implementations. It's also the first tool of choice for physicists, so who knows ...?
My guess, though, is that if he improved the performance, he used some other wizardry (Chebyshev or something similar).
- whatshisface 2y agoSometimes what you need is less precision, much faster. Carmack's famous inverse square root falls into this category. If anything it's a lesson that the definition of brilliance is being in the wrong place at the wrong time... ;-)
- cjbgkagh 2y agoI think Carmack credits someone else as the origin - possibly some magazine entry. These days I think the reciprocal square root intrinsic is the fastest where precision is not that important. I think there was a bit twiddling hack for pop count which was consistently faster than the equivalent cpu intrinsic due to some weird pipelining effect, so sometimes it is possible to beat the compilers and intrinsics with clever hacks.
- michaelcampbell 2y agoCarmack denied writing it, and if WP is to be believed, he didn't. https://en.wikipedia.org/wiki/Fast_inverse_square_root https://en.wikipedia.org/wiki/Fast_inverse_square_root
- dingnuts 2y agoHonestly the whole story sounds like a tall tale to me. > He also learned C++ in a weekend and was vastly better at it by the end of that weekend than most people I’ve met in industry I doubt this. Really, really doubt this. Sure, geniuses exist, but I don't buy it.
- mrguyorama 2y agoHaving seen physicists code, I REALLY doubt this.
- BeetleB 2y agoBah! Let's go invert the matrix!
- null_shift 2y agoIf he already knew how to code in other object oriented languages, and was really just learning C++ syntax over the weekend, it’s not as much of a stretch.
- cudgy 2y agoC++ is one of the most flexible and unopinionated languages you could ever encounter. The idea that someone who knows a high-level object-oriented language could translate that to immediate success in low-level C++ syntax at a level higher than the experts that developed the libraries over a weekend is frankly fantastical.
- KPGv2 2y ago> the experts that developed the libraries over a weekend is frankly fantastical. this is not synonymous with "most [C++ programmers] in industry" The claim was the person learned it better than most people in industry, not most people writing the libraries upon which the industry is based EDIT: Also we don't technically know when this happened. If this story is from the 1990s, it's a lot more likely, because think of how many shitty C++ programmers there were back then since we didn't have all the language options we do now. It was still the language taught in schools, for example. Then it was Java and Python and JS etc. But back then, Jonny Mackintosh was writing bad C++ out of uni.
- lazyasciiart 2y agoAlso it's constrained to "most people I've met in industry". If OP doesn't work with C++ developers...
- fooker 2y agoThe standard library implementations use Taylor approximations
- morelandjs 2y agohttps://github.com/Duke-QCD/trento/blob/master/src/fast_exp.h https://github.com/Duke-QCD/trento/blob/master/src/fast_exp.... Check it out for yourself! I’m not claiming this was some kind of prodigious programming move, just something memorable that stuck with me.
- DrFalkyn 2y agoLooks like he’s using a lookup table based on std::exp in combo with the Taylor expansion