Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The smartest people I’ve ever worked with to date were from physics grad school. Still remember the time my coworker was doing code profiling, decided he was unhappy that the exponential function from the standard library was too slow, and decided to write a Taylor series approximation that gave him the precision he needed and cut the run time in half. 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. And these were just every day occurrences that made it a thrill to go to work. Working with talented people is a drug.

Some tips for younger people considering it: get involved in undergraduate research, apply to fellowships, shop for an advisor with a good reputation, start anticipating and preparing for an industry transition early, travel, date, and enjoy life!



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).


Sometimes 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... ;-)


Carmack denied writing it, and if WP is to be believed, he didn't.

https://en.wikipedia.org/wiki/Fast_inverse_square_root


I 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.


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.


Looks like he’s using a lookup table based on std::exp in combo with the Taylor expansion


Honestly 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.


If 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.


C++ 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.


> 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.


Also it's constrained to "most people I've met in industry". If OP doesn't work with C++ developers...


It's more likely that he was a decent C developer and learnt the basics of C++ and then ignored most of it.

C++ --


prob why there is so much garbage C++ code. someone needs to set the right way of doing things


Having seen physicists code, I REALLY doubt this.


Bah! Let's go invert the matrix!


The standard library implementations use Taylor approximations


The smartest people I’ve ever worked with were college dropouts.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: