diff options
author | creator1creeper1 <creator1creeper1@airmail.cc> | 2021-08-01 13:08:53 +0200 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-08-03 19:12:06 +0430 |
commit | 8f552c9979d92aead2589c8fb3a6d9298faa5603 (patch) | |
tree | 939aa4a17146fd797c14070a874ec49eee2f717e /Userland/Applications/Calculator/Calculator.h | |
parent | 97d2a5799e78d6d37f55cbd76d0a0d6e2d88aa65 (diff) | |
download | serenity-8f552c9979d92aead2589c8fb3a6d9298faa5603.zip |
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.
Diffstat (limited to 'Userland/Applications/Calculator/Calculator.h')
-rw-r--r-- | Userland/Applications/Calculator/Calculator.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Userland/Applications/Calculator/Calculator.h b/Userland/Applications/Calculator/Calculator.h index c5a92325a4..1ca9fca5c0 100644 --- a/Userland/Applications/Calculator/Calculator.h +++ b/Userland/Applications/Calculator/Calculator.h @@ -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 }; }; |