I have been able to pin it down to the allocate_dynamic switch; if I select allocate_stack, the product computes correctly; allocate_dynamic reliably generates nans. Fixed-precision numbers work just fine, and expression templates on/off make no difference. I'd like to use the dynamic allocation, as I expect to use thousands of digits at times.
I am using clang++, with c++11, on OSX, Boost 1.57.0, Eigen 3.2.4. Same behaviour in 1.56 / 3.2.3.
It seems like maybe an offset issue, but I just can't get there by myself. I've also played with defining the NumTraits in Eigen various ways, but nothing affects the nan behaviour. Does anyone have any ideas?
Well that's weird. The only difference between dynamic and static allocation that I can think of at present is in the way they handle move semantics - dynamically allocated values have destructive moves - which is to say the moved-from-value is left uninitialized. Can you try building with BOOST_NO_CXX11_RVALUE_REFERENCES defined and see if that fixes the issue? If it does, I'll have to investigate what Eigen is doing in this case. John.