mirror of https://github.com/rm-dr/daisy
Hack for large exponents
parent
165dddb714
commit
7cb9dbf2e0
|
@ -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' => '¹',
|
||||
|
|
|
@ -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; }
|
||||
|
|
Loading…
Reference in New Issue