Flush when attempting to pop a usize
This commit is contained in:
parent
73b7571030
commit
d839700437
@ -283,7 +283,7 @@ impl Calculator {
|
|||||||
}
|
}
|
||||||
'E' => {
|
'E' => {
|
||||||
let precision = self.checked_get(0)? as usize;
|
let precision = self.checked_get(0)? as usize;
|
||||||
if precision >= 20 {
|
if precision > 20 {
|
||||||
return Err(CalculatorError::PrecisionTooHigh);
|
return Err(CalculatorError::PrecisionTooHigh);
|
||||||
}
|
}
|
||||||
self.display_mode = CalculatorDisplayMode::Engineering(self.pop_usize()?)
|
self.display_mode = CalculatorDisplayMode::Engineering(self.pop_usize()?)
|
||||||
@ -406,6 +406,7 @@ impl Calculator {
|
|||||||
Ok(f)
|
Ok(f)
|
||||||
}
|
}
|
||||||
pub fn pop_usize(&mut self) -> CalculatorResult<usize> {
|
pub fn pop_usize(&mut self) -> CalculatorResult<usize> {
|
||||||
|
self.flush_l()?;
|
||||||
let f = self.checked_get(0)?;
|
let f = self.checked_get(0)?;
|
||||||
let ret = f as usize;
|
let ret = f as usize;
|
||||||
self.direct_state_change(CalculatorStateChange {
|
self.direct_state_change(CalculatorStateChange {
|
||||||
|
Loading…
Reference in New Issue
Block a user