Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub fn normalize4(&mut self) {
- while !self.coefficients.is_empty() && self.coefficients.last().unwrap().is_zero() {
- self.coefficients.pop();
- }
- }
- pub fn normalize1(&mut self) {
- let mut remove = true;
- while remove {
- remove = match self.coefficients.last() {
- None => false,
- Some(i) => i.is_zero(),
- };
- if remove {
- self.coefficients.pop();
- }
- }
- }
- pub fn normalize2(&mut self) {
- loop {
- match self.coefficients.last() {
- None => {
- break;
- }
- Some(i) => {
- if i.is_zero() {
- self.coefficients.pop();
- } else {
- break;
- }
- }
- }
- }
- }
- pub fn normalize3(&mut self) {
- if !self.coefficients.is_empty() && self.coefficients.last().unwrap().is_zero() {
- self.coefficients.pop();
- self.normalize()
- }
- }
Add Comment
Please, Sign In to add comment