Compare commits

..

No commits in common. "ed44fba94ffef5f500fef54048a83fe890e6c30f" and "693ff1c496caafb0dad34a8ec4a66d7318d77e6f" have entirely different histories.

3 changed files with 6 additions and 14 deletions

View File

@ -5,5 +5,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev] [dependencies]
overflow-checks=false

View File

@ -8,17 +8,14 @@ pub mod parser;
pub mod maths; pub mod maths;
pub fn format(v: &[GaussianRational]) -> String { pub fn format(v: &Vec<GaussianRational>) -> String {
let mut format; let mut format;
format = v[0].format(false); format = v[0].format(false);
if v.len() > 1 { if v.len() > 1 {
let mut format2 = v[1].format(true);
if format2 == "" {
if format == "" { if format == "" {
format = format!("{}x", format2); format = format!("{}x", v[1].format(true));
} else { } else {
format = format!("{format} + {}x", format2); format = format!("{format} + {}x", v[1].format(true));
}
} }
} }
for i in 2..v.len() { for i in 2..v.len() {
@ -44,7 +41,7 @@ pub fn parse(query: &str) -> Result<Node, Box<dyn Error>> {
Ok(ast) Ok(ast)
} }
fn print_reduced_form(equation: &[f64]) { fn print_reduced_form(equation: &Vec<f64>) {
let mut string = String::from("Reduced form: "); let mut string = String::from("Reduced form: ");
for (i, n) in equation.iter().enumerate() { for (i, n) in equation.iter().enumerate() {

View File

@ -17,11 +17,7 @@ fn main() {
process::exit(1); process::exit(1);
}); });
if is_equation { if is_equation {
let mut format = computorv1::format(&evaluated); println!("{} = 0", computorv1::format(&evaluated));
if format == "" {
format = String::from("0");
}
println!("{} = 0", format);
computorv1::maths::solver::solve(evaluated); computorv1::maths::solver::solve(evaluated);
} else { } else {
println!("{} is equal to:", args[1]); println!("{} is equal to:", args[1]);