Modify how modulo is calculated in Normal and Scientific mode. (#412)
## Fixes #111 > The modulo operator on this calculator gives the result that is different to the most used calculators. The current `modrate` function is the equivalent of rem(...)/remainder(...), not mod(...)/modulo(...) available in some popular Math apps. ### Description of the changes: - rename `modrate` in `remrate` to be more accurate. - add `modrate`, calculating modulo similarly to Matlab, Bing, Google calculator, Maxima, Wolfram Alpha and Microsoft Excel - Add `RationalMath::Mod` using `modrate` as an alternative to `Rational::operator%` using `remrate` - Add a helper `SIGN` to retrieve the sign of a `Rational`. - modify `CalcEngine` to use `modrate` in Normal and Scientific mode and `remrate` in Programmer mode. ### How changes were validated: - manually and unit tests added
This commit is contained in:
committed by
Daniel Belcher
parent
ad25feda6b
commit
7a7ceb5888
@@ -13,7 +13,7 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
static constexpr size_t MAX_HISTORY_SIZE = 20;
|
||||
|
||||
namespace CalculatorUnitTests
|
||||
namespace CalculatorEngineTests
|
||||
{
|
||||
TEST_CLASS(CalcEngineTests)
|
||||
{
|
||||
|
Reference in New Issue
Block a user