
That Bugzilla link was extremely helpful - thanks!
I've done a bit more research and I'm pretty sure this WAS a bug in glibc. It's fixed on recent versions of Linux though.
Taking your test program from http://sourceware.org/bugzilla/show_bug.cgi?id=2445 and trying it on some different Linux versions and CPUs resulted in this:
Great research! Thanks for that, I'll patch the source and add some comments, plus a link to this thread.
I'm not suggesting that you put this hack into the official Boost codeline, but just thought it might be useful to anyone in my situation who finds this post via a search engine.
One thing you could try: if you only care about double precision, then you could set: #define BOOST_MATH_PROMOTE_DOUBLE_POLICY false #define BOOST_NO_FENV_H Then this whole exception flag code would be disabled, and evaluation would proceed via the SSE2 double precision registers with the x87 long double code unused. You'd lose a touch of precision (no guard digits in the evaluation) but it should be a bit quicker. HTH, John.