2017-11-28 2 views
0

ASINH ++ : C++ Boost Interval and cosC는 여기에 사용할 수를 간격을 밀어 내가 질문 (답변)과 관련된 질문이

작품 위의 링크에서 제시하는 솔루션을 나를 위해 한 번 쌍곡선을 포함한 대부분의 삼각 함수 . 한번이 쌍곡선의 invers를 사용하려고 할 경우,이 전 다음과 같은 컴파일러 오류 얻을 예를 들어 ASINH() 보자 : 오류를 생성

error C2784: "boost::numeric::interval<T,Policies> 
boost::numeric::asinh(const boost::numeric::interval<T,Policies> &)": 
could not deduce template argument for "const 
boost::numeric::interval<T,Policies> &" from "const double" 

코드입니다 것은

#include "stdafx.h" 
#include <boost/numeric/interval.hpp> 
#include <boost/numeric/interval/rounded_arith.hpp> 

using namespace std; 
using namespace boost::numeric::interval_lib; 
using namespace boost::numeric; 

typedef interval<double, policies<save_state<rounded_transc_std<double> >, 
    checking_base<double> > > Interval; 

int _tmain(int argc, _TCHAR* argv[]) 
{ 
    Interval test = asinh(Interval(1, 1.1)); 

    return 0; 
} 

입니다 1_65_1 부스터를 사용하고 있습니다. 하이퍼 볼릭 함수의 반전을 실행하는 법? 원인의

하나의 해결 방법은 신원

Interval test = log(Interval(1, 1.1) + sqrt(pow(Interval(1, 1.1),2)+1.)); 

이 완벽하게 잘 작동하고 정확한 결과를 얻을 수를 사용하는 것입니다. 그러나 구현 된 asinh 기능을 직접 사용할 수 있어야합니다.

답변

1

는 GCC 또는 연타 사용하여 나를 위해 작동하기 때문에하는 MSVC 관련 버그가있을 수 있습니다 :

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

namespace bn = boost::numeric; 
namespace bni = bn::interval_lib; 

typedef bn::interval<double, bni::policies<bni::save_state<bni::rounded_transc_std<double> >, 
    bni::checking_base<double> > > Interval; 

int main() 
{ 
    Interval test = asinh(Interval(1, 1.1)); 
    std::cout << test; 
} 

인쇄

[0.881374,0.950347]