From d839700437ebb433d791d6b5c4c9eac9634a4ace Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sat, 8 May 2021 11:00:40 -0400 Subject: [PATCH] Flush when attempting to pop a usize --- src/calc.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calc.rs b/src/calc.rs index 202e678..e83aeb1 100644 --- a/src/calc.rs +++ b/src/calc.rs @@ -283,7 +283,7 @@ impl Calculator { } 'E' => { let precision = self.checked_get(0)? as usize; - if precision >= 20 { + if precision > 20 { return Err(CalculatorError::PrecisionTooHigh); } self.display_mode = CalculatorDisplayMode::Engineering(self.pop_usize()?) @@ -406,6 +406,7 @@ impl Calculator { Ok(f) } pub fn pop_usize(&mut self) -> CalculatorResult { + self.flush_l()?; let f = self.checked_get(0)?; let ret = f as usize; self.direct_state_change(CalculatorStateChange {