constants.hpp /usr/include/gecode/third-party/boost/numeric/interval/transc.hpp /usr/include/gecode/third-party/boost/numeric/interval.hpp boost boost::numeric boost::numeric::interval_lib boost::numeric::interval_lib::constants /*Boostinterval/constants.hpptemplateimplementationfile * *Copyright2002HervéBrönnimann,GuillaumeMelquiond,SylvainPion * *DistributedundertheBoostSoftwareLicense,Version1.0. *(SeeaccompanyingfileLICENSE_1_0.txtor *copyathttp://www.boost.org/LICENSE_1_0.txt) */ #ifndefBOOST_NUMERIC_INTERVAL_CONSTANTS_HPP #defineBOOST_NUMERIC_INTERVAL_CONSTANTS_HPP namespaceboost{ namespacenumeric{ namespaceinterval_lib{ namespaceconstants{ //Theseconstantsshouldbeexactlycomputed. //Decimalrepresentationswouldn'tdoitsincethestandarddoesn't //specifytherounding(evennearest)thatshouldbeused. staticconstfloatpi_f_l=13176794.0f/(1<<22); staticconstfloatpi_f_u=13176795.0f/(1<<22); staticconstdoublepi_d_l=(3373259426.0+273688.0/(1<<21))/(1<<30); staticconstdoublepi_d_u=(3373259426.0+273689.0/(1<<21))/(1<<30); template<classT>inlineTpi_lower(){return3;} template<classT>inlineTpi_upper(){return4;} template<classT>inlineTpi_half_lower(){return1;} template<classT>inlineTpi_half_upper(){return2;} template<classT>inlineTpi_twice_lower(){return6;} template<classT>inlineTpi_twice_upper(){return7;} template<>inlinefloatpi_lower<float>(){returnpi_f_l;} template<>inlinefloatpi_upper<float>(){returnpi_f_u;} template<>inlinefloatpi_half_lower<float>(){returnpi_f_l/2;} template<>inlinefloatpi_half_upper<float>(){returnpi_f_u/2;} template<>inlinefloatpi_twice_lower<float>(){returnpi_f_l*2;} template<>inlinefloatpi_twice_upper<float>(){returnpi_f_u*2;} template<>inlinedoublepi_lower<double>(){returnpi_d_l;} template<>inlinedoublepi_upper<double>(){returnpi_d_u;} template<>inlinedoublepi_half_lower<double>(){returnpi_d_l/2;} template<>inlinedoublepi_half_upper<double>(){returnpi_d_u/2;} template<>inlinedoublepi_twice_lower<double>(){returnpi_d_l*2;} template<>inlinedoublepi_twice_upper<double>(){returnpi_d_u*2;} template<>inlinelongdoublepi_lower<longdouble>(){returnpi_d_l;} template<>inlinelongdoublepi_upper<longdouble>(){returnpi_d_u;} template<>inlinelongdoublepi_half_lower<longdouble>(){returnpi_d_l/2;} template<>inlinelongdoublepi_half_upper<longdouble>(){returnpi_d_u/2;} template<>inlinelongdoublepi_twice_lower<longdouble>(){returnpi_d_l*2;} template<>inlinelongdoublepi_twice_upper<longdouble>(){returnpi_d_u*2;} }//namespaceconstants template<classI>inline Ipi() { typedeftypenameI::base_typeT; returnI(constants::pi_lower<T>(), constants::pi_upper<T>(),true); } template<classI>inline Ipi_half() { typedeftypenameI::base_typeT; returnI(constants::pi_half_lower<T>(), constants::pi_half_upper<T>(),true); } template<classI>inline Ipi_twice() { typedeftypenameI::base_typeT; returnI(constants::pi_twice_lower<T>(), constants::pi_twice_upper<T>(),true); } }//namespaceinterval_lib }//namespacenumeric }//namespaceboost #endif//BOOST_NUMERIC_INTERVAL_CONSTANTS_HPP