mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 19:27:36 +00:00
Calculator: Use KeypadValue class instead of double
Calculator now uses the KeypadValue class instead of double in its internal calculations. By not constantly converting to double back-and-forth, we do not use precision simply by, for example, negating a number. This fixes #7484.
This commit is contained in:
parent
97d2a5799e
commit
8f552c9979
6 changed files with 43 additions and 57 deletions
|
@ -6,6 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "KeypadValue.h"
|
||||
|
||||
// This type implements the regular calculator
|
||||
// behavior, such as performing arithmetic
|
||||
// operations and providing a memory cell.
|
||||
|
@ -36,8 +38,8 @@ public:
|
|||
MemAdd
|
||||
};
|
||||
|
||||
double begin_operation(Operation, double);
|
||||
double finish_operation(double);
|
||||
KeypadValue begin_operation(Operation, KeypadValue);
|
||||
KeypadValue finish_operation(KeypadValue);
|
||||
|
||||
bool has_error() const { return m_has_error; }
|
||||
|
||||
|
@ -46,7 +48,7 @@ public:
|
|||
|
||||
private:
|
||||
Operation m_operation_in_progress { Operation::None };
|
||||
double m_saved_argument { 0.0 };
|
||||
double m_mem { 0.0 };
|
||||
KeypadValue m_saved_argument { (i64)0 };
|
||||
KeypadValue m_mem { (i64)0 };
|
||||
bool m_has_error { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue