mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:47:34 +00:00
Calculator: Change internal representation to support perfect division
The purpose of this patch is to support addition, subtraction, multiplication and division without using conversion to double. To this end, we use the BigFraction class of LibCrypto. With this solution, we can store values without any losses and forward rounding as the last step before displaying.
This commit is contained in:
parent
4ab8ad2ed2
commit
53eb35caba
10 changed files with 110 additions and 361 deletions
|
@ -10,8 +10,8 @@
|
|||
|
||||
#include "Calculator.h"
|
||||
#include "Keypad.h"
|
||||
#include "KeypadValue.h"
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCrypto/BigFraction/BigFraction.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
|
||||
class CalculatorWidget final : public GUI::Widget {
|
||||
|
@ -19,7 +19,7 @@ class CalculatorWidget final : public GUI::Widget {
|
|||
public:
|
||||
virtual ~CalculatorWidget() override = default;
|
||||
String get_entry();
|
||||
void set_entry(KeypadValue);
|
||||
void set_entry(Crypto::BigFraction);
|
||||
|
||||
private:
|
||||
CalculatorWidget();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue