1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +00:00

Calculator: Add a "Custom" entry to the rounding menu

This entry pop a dialog to ask the user to enter a value. The Calculator
will automatically put itself in this mode if you enter a number with
more digits in the fractional part than the actual maximum length.
This commit is contained in:
Lucas CHOLLET 2022-09-22 16:55:04 +02:00 committed by Tim Flynn
parent de568f87fd
commit e3b22c395d
8 changed files with 157 additions and 10 deletions

View file

@ -12,7 +12,7 @@
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
#include <LibCrypto/NumberTheory/ModularFunctions.h>
void Keypad::type_digit(int digit)
unsigned Keypad::type_digit(int digit)
{
switch (m_state) {
case State::External:
@ -34,6 +34,7 @@ void Keypad::type_digit(int digit)
m_frac_length.set_to(m_frac_length.plus(1));
break;
}
return m_frac_length.to_u64();
}
void Keypad::type_decimal_point()
@ -139,3 +140,8 @@ void Keypad::set_rounding_length(unsigned rounding_threshold)
{
m_displayed_fraction_length = rounding_threshold;
}
unsigned Keypad::rounding_length() const
{
return m_displayed_fraction_length;
}