diff options
author | John Wiegley <johnw@newartisans.com> | 2009-01-30 19:30:16 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-01-30 19:30:16 -0400 |
commit | e0dd2cd0a44ddbfabadb30da4569e10fd36960a9 (patch) | |
tree | 74e691cce67fbc1e975c918d2acb34733b1fd857 /python | |
parent | 6213dc5af8b365cde2495fddaa465b0427779d00 (diff) | |
download | fork-ledger-e0dd2cd0a44ddbfabadb30da4569e10fd36960a9.tar.gz fork-ledger-e0dd2cd0a44ddbfabadb30da4569e10fd36960a9.tar.bz2 fork-ledger-e0dd2cd0a44ddbfabadb30da4569e10fd36960a9.zip |
Changed to using rational numbers instead of integer approximations.
As a result, dependency on the gdtoa was dropped, and dependency on mpfr was
added.
Diffstat (limited to 'python')
-rw-r--r-- | python/py_amount.cc | 4 | ||||
-rw-r--r-- | python/py_value.cc | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/python/py_amount.cc b/python/py_amount.cc index f5e45888..2df2e1bb 100644 --- a/python/py_amount.cc +++ b/python/py_amount.cc @@ -41,12 +41,14 @@ namespace ledger { using namespace boost::python; +#ifdef INTEGER_MATH amount_t py_round_0(const amount_t& amount) { return amount.round(); } amount_t py_round_1(const amount_t& amount, amount_t::precision_t prec) { return amount.round(prec); } +#endif double py_to_double_0(amount_t& amount) { return amount.to_double(); @@ -268,8 +270,10 @@ internal precision.") .def("abs", &amount_t::abs) .def("__abs__", &amount_t::abs) +#ifdef INTEGER_MATH .def("round", py_round_0) .def("round", py_round_1) +#endif .def("unround", &amount_t::unround) .def("reduce", &amount_t::reduce) diff --git a/python/py_value.cc b/python/py_value.cc index 4156ee44..48cd0feb 100644 --- a/python/py_value.cc +++ b/python/py_value.cc @@ -195,8 +195,10 @@ void export_value() .def("abs", &value_t::abs) .def("__abs__", &value_t::abs) +#ifdef INTEGER_MATH .def("round", &value_t::round) .def("in_place_round", &value_t::in_place_round) +#endif .def("unround", &value_t::unround) .def("reduce", &value_t::reduce) |