Boost logo

Boost :

Subject: Re: [boost] [math] Comeau can't match math::tools::fmod_workaround
From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2009-11-26 14:28:18


Mateusz Loskot wrote:
> Hi,
>
> I'm not sure if I should submit this issue directly to Trac, so I
> decided to post it here first. Compiling Boost.Math using Comeau + GCC
> on Linux throws error that suggests mismatch of dobule and long double
> where single type T is expected:
>
> como-linux.compile.c++
> ../../../bin.v2/libs/math/build/como-linux/debug/link-static/ellint_3l.o
> Comeau C/C++ 4.3.10.1 (May 7 2008 12:23:21) for LINUX_INTEL_ELF_Beta
> Copyright 1988-2008 Comeau Computing. All rights reserved.
> MODE:non-strict warnings C++ noC++0x_extensions
>
> "../../../boost/math/special_functions/ellint_3.hpp", line 185: error: no
> instance of function template
> "boost::math::tools::fmod_workaround"
> matches the argument list
> argument types are: (double, long double)
> T rphi = boost::math::tools::fmod_workaround(fabs(phi),
> T(constants::pi<T>() / 2));
> ^
> detected during instantiation of "T
> boost::math::detail::ellint_pi_imp(T, T, T, T, const
> Policy &) [with T=long double,
> Policy=c_policies::c_policy]" at line 309
>

Replacing single line 185 with call to math::tools::fmod_workaround
in file trunk/boost/math/special_functions/ellint_3.hpp
with separately cached results of fabs and pi<T> functions
enables compilation without errors:

       T f = fabs(phi);
       T pi2 = T(constants::pi<T>() / 2);
       T rphi = boost::math::tools::fmod_workaround(f, pi2);
       T m = floor((2 * fabs(phi)) / constants::pi<T>());

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk