Boost logo

Boost :

Subject: [boost] [interval] rounded_arith_opp doesn't work in Release configuration under msvc 14
From: Peter Azmanov (peter.azmanov_at_[hidden])
Date: 2016-02-25 12:57:34


Hello,

Interval calculations with rounded_arith_opp in Release configuration under
msvc 14 result in zero-size intervals. For example consider following:

#include <iostream>
#include <boost/numeric/interval.hpp>

int main(int argc, char * argv[])
{
   unsigned int ctrl = _control87(0, 0);
   _control87(_EM_INEXACT | _RC_UP, _MCW_EM | _MCW_RC);

   using namespace boost::numeric::interval_lib;
   typedef typename unprotect< boost::numeric::interval<double> >::type
interval_t;

   interval_t test = interval_t(1.) / interval_t(3.);
   std::cout << "test.lower() != test.upper(): " << std::boolalpha
             << (test.lower() != test.upper()) << std::endl;

   return 0;
}

This test unexpectedly prints:
test.lower() != test.upper(): false

Tested on x64 platform with /fp:strict and /fp:precise under MS Visual
Studio Community 2015 Version 14.0.24720.00 Update 1, Boost 1.60.

I've already reported this to https://svn.boost.org/trac/boost/ticket/12018
There you can find some details of what I think is going wrong and proposed
workaround patch.

I didn't create pull request because I'm not sure if my patch is a correct
workaround. Maybe someone will propose more appropriate solution.

Best regards,
Peter Azmanov.


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