I can see that you have found out the same as I have. The rint() function is not supported by the MSVC standard math library.

I have found several rint() implementations using google, but will it help to put this into the version that I am limited to (1.36)? I can see that rint() is also in the new 1.44 version "msvc_rounding_control.hpp". Is it something I am doing wrong?

/Lars

2010/9/16 Paul A. Bristow <pbristow@hetp.u-net.com>


> -----Original Message-----
> From: boost-users-bounces@lists.boost.org [mailto:boost-users-
> bounces@lists.boost.org] On Behalf Of John Maddock
> Sent: Thursday, September 16, 2010 5:05 PM
> To: boost-users@lists.boost.org
> Subject: Re: [Boost-users] Linker error on windows
>
> >> > I am using BOOST to do math and have not been able to get the
> >> > "findroot_demo.cpp" example of root finding to work. There seem to
> >> > be a reference to rint(), which is not implemented in the C++
> >> > library for windows. How can I solve this - my understanding of
> >> > BOOST is that it is cross-platform?
>
> Unfortunately this is either a Boost or an MSVC bug depending upon your
point
> of view :-(
>
> Boost.Interval depends upon a number of std lib rounding functions to do
it's
> work.  One of them is "rint" which MSVC used to supply, but for some
reason
> recent releases have simply dropped it, with no suitable replacement.
> If you google for msvc and rint you should find some replacements for that
> function.

I tried this quickly using naïve (but plausible) rint code

double rint(double x)
{
    return floor(x + 0.5);
}

from

http://suncallmoonbright.blogspot.com/2008/12/mingw-to-msvc-case-of-rint.htm
l

but then I got the error below -and decided someone who knew more about it
should look at it ;-)

Paul


---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow@hetp.u-net.com



I:\boost-trunk\boost/numeric/interval/rounded_arith.hpp(108): error C3861:
'to_int': identifier not found
         I:\boost-trunk\boost/numeric/interval/rounded_arith.hpp(108) :
while compiling class template member function 'double
boost::numeric::interval_lib::rounded_arith_opp<T>::int_down(const T &)'
         with
         [
             T=double
         ]
         I:\boost-trunk\boost/numeric/interval/rounding.hpp(77) : see
reference to class template instantiation
'boost::numeric::interval_lib::rounded_arith_opp<T>' being compiled
         with
         [
             T=double
         ]
         I:\boost-trunk\boost/numeric/interval/hw_rounding.hpp(59) : see
reference to class template instantiation
'boost::numeric::interval_lib::save_state<Rounding>' being compiled
         with
         [

Rounding=boost::numeric::interval_lib::rounded_arith_opp<double>
         ]


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users