From 5cac0e61538737c2bd1f7d08526c9db41adeebdb Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 18 Sep 2023 13:20:34 -0700 Subject: [PATCH] zeroes --- src/lib.rs | 1 + src/zeroes.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/zeroes.rs diff --git a/src/lib.rs b/src/lib.rs index fd9d95a..88b93b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ pub mod framework; pub mod body; +pub mod zeroes; pub mod instruction; diff --git a/src/zeroes.rs b/src/zeroes.rs new file mode 100644 index 0000000..02fec71 --- /dev/null +++ b/src/zeroes.rs @@ -0,0 +1,27 @@ +//find roots of polynomials +pub fn zeroes2(a0:f32,a1:f32,a2:f32) -> Vec{ + if a2==0f32{ + return zeroes1(a0, a1); + } + let mut radicand=a1*a1-4f32*a2*a0; + if 0f32 Vec { + if a1==0f32{ + return vec![]; + } else { + return vec![-a0/a1]; + } +} \ No newline at end of file