Loading...
Searching...
No Matches
mp_wrapper.cpp
1#include <symengine/mp_wrapper.h>
2#include <stdlib.h>
3
4namespace SymEngine
5{
6#if SYMENGINE_INTEGER_CLASS == SYMENGINE_FLINT
7std::ostream &operator<<(std::ostream &os, const fmpz_wrapper &f)
8{
9 char *c = fmpz_get_str(NULL, 10, f.get_fmpz_t());
10 os << std::string(c);
11 free(c);
12 return os;
13}
14
15std::ostream &operator<<(std::ostream &os, const fmpq_wrapper &f)
16{
17 char *c = fmpq_get_str(NULL, 10, f.get_fmpq_t());
18 os << std::string(c);
19 free(c);
20 return os;
21}
22#elif SYMENGINE_INTEGER_CLASS == SYMENGINE_GMP
23
24std::ostream &operator<<(std::ostream &os, const mpz_wrapper &f)
25{
26 char *c = mpz_get_str(NULL, 10, f.get_mpz_t());
27 os << std::string(c);
28 free(c);
29 return os;
30}
31
32std::ostream &operator<<(std::ostream &os, const mpq_wrapper &f)
33{
34 char *c = mpq_get_str(NULL, 10, f.get_mpq_t());
35 os << std::string(c);
36 free(c);
37 return os;
38}
39#endif
40
41} // namespace SymEngine
T free(T... args)
Main namespace for SymEngine package.
Definition: add.cpp:19
std::ostream & operator<<(std::ostream &out, const SymEngine::Basic &p)
<< Operator
Definition: basic-inl.h:104