Show estimates when printing vector and matrices

This commit is contained in:
bakk 2022-01-16 21:08:56 +01:00
parent 61713b0ead
commit 46d8f5055d

View File

@ -215,7 +215,7 @@ impl std::fmt::Display for KalkValue {
"({})", "({})",
values values
.iter() .iter()
.map(|x| x.to_string()) .map(|x| x.estimate().unwrap_or_else(|| x.to_string()))
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join(", ") .join(", ")
) )
@ -225,7 +225,7 @@ impl std::fmt::Display for KalkValue {
let mut longest = 0; let mut longest = 0;
for row in rows { for row in rows {
for value in row { for value in row {
let value_str = value.to_string(); let value_str = value.estimate().unwrap_or_else(|| value.to_string());
longest = longest.max(value_str.len()); longest = longest.max(value_str.len());
value_strings.push(format!("{},", value_str)); value_strings.push(format!("{},", value_str));
} }