diff options
author | bnewbold <bnewbold@robocracy.org> | 2017-01-28 21:36:49 -0800 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2017-01-28 21:36:49 -0800 |
commit | 97b0fc2295adcdb1ba54e003227f486a92425acd (patch) | |
tree | 5ff8f4c3a76681955cf33a456bc149b1d3ac1d00 /src | |
parent | 1aec9b6479beecd327456780ae7c711040011933 (diff) | |
download | modelthing-97b0fc2295adcdb1ba54e003227f486a92425acd.tar.gz modelthing-97b0fc2295adcdb1ba54e003227f486a92425acd.zip |
switch to sci notation for floats (except latex)
Diffstat (limited to 'src')
-rw-r--r-- | src/repr_latex.rs | 3 | ||||
-rw-r--r-- | src/transpile_js.rs | 2 | ||||
-rw-r--r-- | src/transpile_python.rs | 2 | ||||
-rw-r--r-- | src/transpile_scheme.rs | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/src/repr_latex.rs b/src/repr_latex.rs index 51c9e7a..09bf549 100644 --- a/src/repr_latex.rs +++ b/src/repr_latex.rs @@ -53,7 +53,6 @@ r#"<tr><td>\({name}\)</td> d.clone() } else { "".to_string() })); } - let rows = rows.join("\n"); Ok(format!( r#"<table> <tr><th>Variable @@ -64,7 +63,7 @@ r#"<table> </tr> {rows} </table>"#, - rows = rows.join("\n ")) + rows = rows.join("\n "))) } } diff --git a/src/transpile_js.rs b/src/transpile_js.rs index 586abc1..282240b 100644 --- a/src/transpile_js.rs +++ b/src/transpile_js.rs @@ -105,7 +105,7 @@ impl TranspileJS for Expr { use modelica_parser::Expr::*; match *self { Integer(e) => Ok(format!("{}", e)), - Float(e) => Ok(format!("{}", e)), + Float(e) => Ok(format!("{:e}", e)), Boolean(true) => Ok(format!("true")), Boolean(false) => Ok(format!("false")), StringLiteral(ref s) => Ok(format!("\"{}\"", s)), diff --git a/src/transpile_python.rs b/src/transpile_python.rs index d980e60..f38f699 100644 --- a/src/transpile_python.rs +++ b/src/transpile_python.rs @@ -122,7 +122,7 @@ impl TranspilePython for Expr { use modelica_parser::BinOperator::*; match *self { Integer(e) => Ok(format!("{}", e)), - Float(e) => Ok(format!("{}", e)), + Float(e) => Ok(format!("{:e}", e)), Boolean(true) => Ok(format!("True")), Boolean(false) => Ok(format!("False")), StringLiteral(ref s) => Ok(format!("\"{}\"", s)), diff --git a/src/transpile_scheme.rs b/src/transpile_scheme.rs index d6f437a..57bc932 100644 --- a/src/transpile_scheme.rs +++ b/src/transpile_scheme.rs @@ -53,7 +53,7 @@ impl TranspileScheme for Expr { use modelica_parser::Expr::*; match *self { Integer(e) => Ok(format!("{}", e)), - Float(e) => Ok(format!("{}", e)), + Float(e) => Ok(format!("{:e}", e)), Boolean(true) => Ok(format!("#t")), Boolean(false) => Ok(format!("#f")), StringLiteral(ref s) => Ok(format!("\"{}\"", s)), |