diff options
author | Teddy <[email protected]> | 2013-08-09 20:20:14 +0800 |
---|---|---|
committer | Teddy <[email protected]> | 2013-08-09 20:20:14 +0800 |
commit | db59e90e97adaacf758bbd5f4cd86ed9b30262d6 (patch) | |
tree | f85ae4b0983c37d66da2ea50e44034a692b037d4 | |
parent | 5eae404fc464674870a73b607a5bdcd8665be27e (diff) |
canonicalize the rational number to avoid crash
-rw-r--r-- | builtin.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin.cpp b/builtin.cpp index 610cdec..94fcd9b 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -327,6 +327,7 @@ RatNumObj *RatNumObj::from_string(string repr) { try { mpq_class ret(repr, 10); + ret.canonicalize(); return new RatNumObj(ret); } catch (std::invalid_argument &e) |