From db59e90e97adaacf758bbd5f4cd86ed9b30262d6 Mon Sep 17 00:00:00 2001 From: Teddy Date: Fri, 9 Aug 2013 20:20:14 +0800 Subject: canonicalize the rational number to avoid crash --- builtin.cpp | 1 + 1 file changed, 1 insertion(+) 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) -- cgit v1.2.3-70-g09d2