提高多precision失败,因为复杂的实现尝试投在像_Isinf或_Isnan内部功能将翻一番 [英] Boost multiprecision fails because the implementation of complex tries to cast to double in internal functions like _Isinf or _Isnan

查看:360
本文介绍了提高多precision失败,因为复杂的实现尝试投在像_Isinf或_Isnan内部功能将翻一番的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个类似BSD授权的C(++)多precision库复数支持,所以我尝试提升。

I need a BSD-like licensed C(++) multiprecision library with complex numbers support so I tried boost.

以下code失败:

#include <boost/multiprecision/cpp_dec_float.hpp>
#include <complex>

using namespace boost::multiprecision;    
std::complex<cpp_dec_float_50>(1.0, 2.0) / std::complex<cpp_dec_float_50>(1.0, 2.0)

在Visual Studio 2012与错误C2440,因为复杂的实现尝试投在像_Isinf或_Isnan内部功能将翻一番。

in Visual Studio 2012 with an error C2440 because the implementation of complex tries to cast to double in internal functions like _Isinf or _Isnan.

这是我的一部分错误?我该如何解决这个问题?有没有更好的库?

Is this an error on my part? How can I fix this? Are there better libraries?

推荐答案

从C ++ 11 26.4 / 2:

From C++11 26.4/2:

实例的模板复合物为其他任何类型的效果
  比浮动,双或long double是不确定的。

The effect of instantiating the template complex for any type other than float, double, or long double is unspecified.

所以你不能可靠地使用的std ::复杂与其他类型的,但也许升压有一个复杂类型与 cpp_dec_float_50

So you can't reliably use std::complex with other types, but perhaps boost has a complex type that works with cpp_dec_float_50.

这篇关于提高多precision失败,因为复杂的实现尝试投在像_Isinf或_Isnan内部功能将翻一番的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆