Don't print unreasonably large exact fractions

This commit is contained in:
Tiffany Bennett 2016-08-07 10:17:24 -04:00
parent bab6f25a3b
commit f57ee7f1d5

View file

@ -217,7 +217,11 @@ impl Context {
let (exact, approx) = match to_string(&value.0) {
(true, v) => (v, None),
(false, v) => (format!("{:?}", value.0), Some(v))
(false, v) => if value.0.get_den() > Mpz::from(1_000_000) {
(format!("approx. {}", v), None)
} else {
(format!("{:?}", value.0), Some(v))
}
};
write!(out, "{}", exact).unwrap();