diff --git a/src/parser/expression/operator.rs b/src/parser/expression/operator.rs index 1486dd9..9794b1d 100644 --- a/src/parser/expression/operator.rs +++ b/src/parser/expression/operator.rs @@ -209,11 +209,11 @@ impl Operator { let q = &args[1]; - if q.is_unitless_integer() { + if q.is_unitless_integer() && !q.to_string().contains("e") { // Write integer powers as a superscript let mut b = String::new(); for c in q.to_string().chars() { - b.push( match c { + b.push(match c { '-' => '⁻', '0' => '⁰', '1' => '¹', diff --git a/src/quantity/unit/unit.rs b/src/quantity/unit/unit.rs index b068504..40e35c4 100644 --- a/src/quantity/unit/unit.rs +++ b/src/quantity/unit/unit.rs @@ -37,7 +37,7 @@ impl ToString for Unit { if *p == Scalar::new_rational(1f64).unwrap() { t.push_str(&format!("{c}·")); - } else if p.is_int() { + } else if p.is_int() && !p.to_string().contains("e"){ t.push_str(&c); for c in p.to_string().chars() { t.push( match c { @@ -74,7 +74,7 @@ impl ToString for Unit { bottom_count += 1; if t.len() != 0 && *p == Scalar::new_rational(-1f64).unwrap() { b.push_str(&format!("{c}·")); - } else if p.is_int() { + } else if p.is_int() && !p.to_string().contains("e") { b.push_str(&c); for c in p.to_string().chars() { if c == '-' && t.len() != 0 { continue; }