mirror of
https://github.com/tiffany352/rink-rs
synced 2024-09-20 22:21:57 +00:00
Don't print unreasonably large exact fractions
This commit is contained in:
parent
bab6f25a3b
commit
f57ee7f1d5
1 changed files with 5 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue