summaryrefslogtreecommitdiff
path: root/lib/GMPString.cc
blob: 5fb76c8a28d40f535f1712eac0f905a3f4254d53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_GMP
#include <gmpxx.h>
#include "GMPString.h"

GMPString::GMPString(const GMPString & s) : str(s.str) {
}

GMPString::GMPString(const mpz_class & z) {
    gmp_asprintf(&str, "%Zd", z.get_mpz_t());
}

GMPString::GMPString(const mpq_class & q) {
    gmp_asprintf(&str, "%Qd", q.get_mpq_t());
}

GMPString::GMPString(const mpf_class & f) {
    gmp_asprintf(&str, "%Ff", f.get_mpf_t());
}

GMPString::operator String() const {
    return String(str);
}

GMPString::~GMPString() {
}

#endif