
This Fatal Error occurs when trying to compile a MSVC 2003 (SP1) project using the proposed Math Toolkit: C:\boost_1_34_0_beta\boost_1_34_0\boost\math\special_functions\log1p.hpp(195 ): error C2785: 'tools::promote_args<T>::type boost::math::log1p(T)' and 'double boost::math::log1p(double)' have different return types Any fix to this error? Leopoldo Peralta

Leopoldo Peralta wrote:
This Fatal Error occurs when trying to compile a MSVC 2003 (SP1) project using the proposed Math Toolkit:
Any fix to this error?
Most strange, VC8 handles it fine, and it appears to be a comiler bug, but I can't find a workaround at present, so the diff below is the only fix I have for now. John. Index: ../../../boost/math/special_functions/log1p.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/math/special_functions/Atti c/log1p.hpp,v retrieving revision 1.1.2.11 diff -u -r1.1.2.11 log1p.hpp --- ../../../boost/math/special_functions/log1p.hpp 6 Feb 2007 13:32:59 -0000 1.1.2.11 +++ ../../../boost/math/special_functions/log1p.hpp 28 Apr 2007 17:34:33 -0000 @@ -172,7 +172,7 @@ BOOST_CURRENT_FUNCTION); return ::log1p(x); } -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && (BOOST_MSVC >= 1400) // // You should only enable this branch if you are absolutely sure // that your compilers optimizer won't mess this code up!!

This Error occurs (MSVC 2003 + SP1) when calling boost::math::log1p ------------------- c:\boost_1_34_0_beta\boost_1_34_0\boost\math\special_functions\log1p.hpp(83) : error C2784: 'boost::rational<IntType> boost::abs(const boost::rational<IntType> &)' : could not deduce template argument for 'const boost::rational<IntType> &' from 'boost::math::tools::promote_args<T1,T2,T3,T4,T5,T6>::type' with [ T1=double, T2=float, T3=float, T4=float, T5=float, T6=float ] ------------------- Same error is thrown when trying to call boost::math::complex functions. Any fix to this? Leopoldo Peralta -----Mensaje original----- De: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] En nombre de John Maddock Enviado el: Saturday, April 28, 2007 12:36 PM Para: boost@lists.boost.org Asunto: Re: [boost] [math toolkit] Leopoldo Peralta wrote:
This Fatal Error occurs when trying to compile a MSVC 2003 (SP1) project using the proposed Math Toolkit:
Any fix to this error?
Most strange, VC8 handles it fine, and it appears to be a comiler bug, but I can't find a workaround at present, so the diff below is the only fix I have for now. John. Index: ../../../boost/math/special_functions/log1p.hpp =================================================================== RCS file: /cvsroot/boost-sandbox/boost-sandbox/boost/math/special_functions/Atti c/log1p.hpp,v retrieving revision 1.1.2.11 diff -u -r1.1.2.11 log1p.hpp --- ../../../boost/math/special_functions/log1p.hpp 6 Feb 2007 13:32:59 -0000 1.1.2.11 +++ ../../../boost/math/special_functions/log1p.hpp 28 Apr 2007 17:34:33 -0000 @@ -172,7 +172,7 @@ BOOST_CURRENT_FUNCTION); return ::log1p(x); } -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && (BOOST_MSVC >= 1400) // // You should only enable this branch if you are absolutely sure // that your compilers optimizer won't mess this code up!! _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Leopoldo Peralta wrote:
This Error occurs (MSVC 2003 + SP1) when calling boost::math::log1p
Hopefully this has been fixed in current SVN, see http://svn.boost.org/trac/boost/browser/sandbox/math_toolkit/boost/math/spec... If not, let me have a test case and I'll look into it. HTH, John.

Thanks John, I will go to the SVN and try the current log1p.hpp. I will let you know the results. Leopoldo -----Mensaje original----- De: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] En nombre de John Maddock Enviado el: Sunday, July 01, 2007 11:01 AM Para: boost@lists.boost.org Asunto: Re: [boost] [math toolkit] Leopoldo Peralta wrote:
This Error occurs (MSVC 2003 + SP1) when calling boost::math::log1p
Hopefully this has been fixed in current SVN, see http://svn.boost.org/trac/boost/browser/sandbox/math_toolkit/boost/math/spec ial_functions/log1p.hpp If not, let me have a test case and I'll look into it. HTH, John. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

I went to the current SVN and updated the log1.hpp file in my Boost installation. The same error that I reported occurs. Going deeper into my Boost based project , I found that this particular error happens only when the Boost Rational Library is included. For example, this code works fine: #define BOOST_MATH_THROW_ON_DOMAIN_ERROR #include <boost/math/distributions/students_t.hpp> #include <boost/math/special_functions/log1p.hpp> #include <iomanip> using namespace boost::math; int _tmain(int argc, _TCHAR* argv[]) { double d = log1p(5.78); students_t_distribution<float> d3(12); } However, this one will prevent compiling: #define BOOST_MATH_THROW_ON_DOMAIN_ERROR #include <boost/rational.hpp> // <----- Causes Error #include <boost/math/distributions/students_t.hpp> #include <boost/math/special_functions/log1p.hpp> #include <iomanip> using namespace boost::math; int _tmain(int argc, _TCHAR* argv[]) { double d = log1p(5.78); students_t_distribution<float> d3(12); } Error is: C:\boost_1_34_0_beta\boost_1_34_0\boost\math\special_functions\log1p.hpp(83) : error C2784: 'boost::rational<IntType> boost::abs(const boost::rational<IntType> &)' : could not deduce template argument for 'const boost::rational<IntType> &' from 'boost::math::tools::promote_args<T1,T2,T3,T4,T5,T6>::type' with [ T1=double, T2=float, T3=float, T4=float, T5=float, T6=float ] It seems to me that boost\math\tools\promotion.hpp tool may need some fix to avoid this conflicting interaction between Boost::Rational and Boost::MathToolKit Leopoldo -----Mensaje original----- De: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] En nombre de John Maddock Enviado el: Sunday, July 01, 2007 11:01 AM Para: boost@lists.boost.org Asunto: Re: [boost] [math toolkit] Leopoldo Peralta wrote:
This Error occurs (MSVC 2003 + SP1) when calling boost::math::log1p
Hopefully this has been fixed in current SVN, see http://svn.boost.org/trac/boost/browser/sandbox/math_toolkit/boost/math/spec ial_functions/log1p.hpp If not, let me have a test case and I'll look into it. HTH, John. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Leopoldo Peralta wrote:
I went to the current SVN and updated the log1.hpp file in my Boost installation. The same error that I reported occurs.
Going deeper into my Boost based project , I found that this particular error happens only when the Boost Rational Library is included.
It seems to me that boost\math\tools\promotion.hpp tool may need some fix to avoid this conflicting interaction between Boost::Rational and Boost::MathToolKit
OK I've tracked this down: just add a using std::abs; At the start of the log1p function definition. A patch is going into SVN now. HTH, John.

Thanks John, Now it works perfectly. Incidentally, have you considered for the Math toolkit some generical financial objects (i.e.: time value, futures, Capital Asset Pricing Model, etc)? Leopoldo -----Mensaje original----- De: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] En nombre de John Maddock Enviado el: Monday, July 02, 2007 4:44 AM Para: boost@lists.boost.org Asunto: Re: [boost] [math toolkit] Leopoldo Peralta wrote:
I went to the current SVN and updated the log1.hpp file in my Boost installation. The same error that I reported occurs.
Going deeper into my Boost based project , I found that this particular error happens only when the Boost Rational Library is included.
It seems to me that boost\math\tools\promotion.hpp tool may need some fix to avoid this conflicting interaction between Boost::Rational and Boost::MathToolKit
OK I've tracked this down: just add a using std::abs; At the start of the log1p function definition. A patch is going into SVN now. HTH, John. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Leopoldo Peralta wrote:
Thanks John,
Now it works perfectly.
Incidentally, have you considered for the Math toolkit some generical financial objects (i.e.: time value, futures, Capital Asset Pricing Model, etc)?
Regrettably I don't know enough about the problem domain to be sure of doing the right thing with those :-( Plus, there's that old finding enough time problem....! Non-central distributions are the most likely next addition, but first I have to work through the review comments and get a 1.0 release out. John.
participants (2)
-
John Maddock
-
Leopoldo Peralta