summaryrefslogtreecommitdiff
path: root/lib/GMPString.cc
blob: ee4debb024a8ed56046d4284f9c7338c0f101786 (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
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_GMP
#include <gmpxx.h>
#include "GMPString.h"
#include "gettext.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);
}

#endif