initial commit
This commit is contained in:
0
python/toUpload
Normal file
0
python/toUpload
Normal file
1
rust/day1/.gitignore
vendored
Normal file
1
rust/day1/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/target
|
||||||
6
rust/day1/Cargo.toml
Normal file
6
rust/day1/Cargo.toml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[package]
|
||||||
|
name = "day1"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
14
rust/day1/src/main.rs
Normal file
14
rust/day1/src/main.rs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("{:?}", calEVlas(-5.0, -7.0, 2.0, 4.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn calEVlas(a: f32, b: f32, c: f32, d: f32) -> Vec<f32> {
|
||||||
|
let trace = a + d;
|
||||||
|
let determinant = (a * d) - (b * c);
|
||||||
|
println!("{determinant}");
|
||||||
|
let discri = (trace.powi(2)) - (4.0 * determinant);
|
||||||
|
println!("{discri}");
|
||||||
|
let x1 = (-trace + (discri.powf(0.5))) / 2.0;
|
||||||
|
let x2 = (-trace - (discri.powf(0.5))) / 2.0;
|
||||||
|
return vec![x1, x2];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user