Macaulay2 Engine
Loading...
Searching...
No Matches

◆ operator=() [1/15]

mpreal & mpfr::mpreal::operator= ( const char * s)
inline

Definition at line 1066 of file mpreal.h.

1067{
1068 // Use other converters for more precise control on base & precision & rounding:
1069 //
1070 // mpreal(const char* s, mp_prec_t prec, int base, mp_rnd_t mode)
1071 // mpreal(const std::string& s,mp_prec_t prec, int base, mp_rnd_t mode)
1072 //
1073 // Here we assume base = 10 and we use precision of target variable.
1074
1075 mpfr_t t;
1076
1077 mpfr_init2(t, mpfr_get_prec(mpfr_srcptr()));
1078
1079 if(0 == mpfr_set_str(t, s, 10, mpreal::get_default_rnd()))
1080 {
1081 mpfr_set(mpfr_ptr(), t, mpreal::get_default_rnd());
1083 }
1084
1085 clear(t);
1086 return *this;
1087}
MPREAL_MSVC_DEBUGVIEW_DATA void clear(::mpfr_ptr)
Definition mpreal.h:770
::mpfr_srcptr mpfr_srcptr() const
Definition mpreal.h:1767
::mpfr_ptr mpfr_ptr()
Definition mpreal.h:1765
void size_t s
Definition m2-mem.cpp:271
#define MPREAL_MSVC_DEBUGVIEW_CODE
Definition mpreal.h:146

References clear(), get_default_rnd(), mpfr_ptr(), mpfr_srcptr(), mpreal(), MPREAL_MSVC_DEBUGVIEW_CODE, operator=(), and s.