Hack for large exponents

pull/2/head
Mark 2023-08-03 07:47:07 -07:00
parent 165dddb714
commit 7cb9dbf2e0
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
2 changed files with 4 additions and 4 deletions

View File

@ -209,11 +209,11 @@ impl Operator {
let q = &args[1]; 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 // Write integer powers as a superscript
let mut b = String::new(); let mut b = String::new();
for c in q.to_string().chars() { for c in q.to_string().chars() {
b.push( match c { b.push(match c {
'-' => '⁻', '-' => '⁻',
'0' => '⁰', '0' => '⁰',
'1' => '¹', '1' => '¹',

View File

@ -37,7 +37,7 @@ impl ToString for Unit {
if *p == Scalar::new_rational(1f64).unwrap() { if *p == Scalar::new_rational(1f64).unwrap() {
t.push_str(&format!("{c}·")); t.push_str(&format!("{c}·"));
} else if p.is_int() { } else if p.is_int() && !p.to_string().contains("e"){
t.push_str(&c); t.push_str(&c);
for c in p.to_string().chars() { for c in p.to_string().chars() {
t.push( match c { t.push( match c {
@ -74,7 +74,7 @@ impl ToString for Unit {
bottom_count += 1; bottom_count += 1;
if t.len() != 0 && *p == Scalar::new_rational(-1f64).unwrap() { if t.len() != 0 && *p == Scalar::new_rational(-1f64).unwrap() {
b.push_str(&format!("{c}·")); b.push_str(&format!("{c}·"));
} else if p.is_int() { } else if p.is_int() && !p.to_string().contains("e") {
b.push_str(&c); b.push_str(&c);
for c in p.to_string().chars() { for c in p.to_string().chars() {
if c == '-' && t.len() != 0 { continue; } if c == '-' && t.len() != 0 { continue; }