本文整理汇总了C++中SymEngine::real_mpfr方法的典型用法代码示例。如果您正苦于以下问题:C++ SymEngine::real_mpfr方法的具体用法?C++ SymEngine::real_mpfr怎么用?C++ SymEngine::real_mpfr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymEngine
的用法示例。
在下文中一共展示了SymEngine::real_mpfr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: a
#ifdef HAVE_SYMENGINE_MPC
using SymEngine::mpc_class;
using SymEngine::complex_mpc;
using SymEngine::ComplexMPC;
using SymEngine::eval_mpc;
#endif
TEST_CASE("RealMPFR: arithmetic", "[number]")
{
#ifdef HAVE_SYMENGINE_MPFR
mpfr_class a(100), b(100), d(100), c(100);
mpfr_set_ui(a.get_mpfr_t(), 10, MPFR_RNDN);
mpfr_set_ui(b.get_mpfr_t(), 20, MPFR_RNDN);
mpfr_set_ui(c.get_mpfr_t(), 100, MPFR_RNDN);
mpfr_set_ui(d.get_mpfr_t(), 1024, MPFR_RNDN);
RCP<const Number> r1 = real_mpfr(std::move(a));
RCP<const Number> r2 = real_mpfr(std::move(b));
RCP<const Number> r3 = real_mpfr(std::move(c));
RCP<const Number> r4 = real_mpfr(std::move(d));
RCP<const Number> r5 = subnum(integer(0), r1);
RCP<const Number> i1 = integer(1);
RCP<const Number> i2 = integer(2);
RCP<const Number> half = integer(1)->div(*integer(2));
RCP<const Number> c1 = Complex::from_two_nums(*i1, *i1);
RCP<const Number> rat1 = Rational::from_two_ints(*integer(10), *integer(3));
RCP<const Number> rd1 = real_double(10.0);
RCP<const Number> cd1 = complex_double(std::complex<double>(1, 2));
REQUIRE(not r1->is_one());
REQUIRE(not r1->is_minus_one());
REQUIRE(not r1->is_complex());