CalcEngine: Manage precision internally to Rational and convert functions to operator overrides (#35)

* Convert Rational::Negate to an operator override
* Convert Rational::Add to + and += operator overrides.
* Convert Rational::Sub to - and -= operator overrides.
* Convert Rational::Div and ::Mul to use /, /=, *, *= operator overrides.
* Convert Rational::Mod to use %= and % operator overrides
* Convert Rational::Rsh and ::Lsh to use >>=, >>, <<=, << operator overrides
* Convert Rational::And, ::Or, ::Xor to use &=, &, |=, |, ^=, ^ operator overrides
* Convert Rational relational functions to operator overrides
* Remove unnecessary precision arguments from Rational class and remove use of explicit Rational constructors in favor of implicit conversions for value types
* Remove unnecessary precision variable from RationalMath operations
* Replace unnecessary Rational::Not with Xor operation
* Remove unnecessary Rational::IsZero() in favor of == 0 comparisons
* Fix rounding issues in ratpak that result from using large precisions.
* Move assignment stmt out of IsCurrentTooBigForTrig
This commit is contained in:
Josh Koon
2019-02-25 11:41:32 -08:00
committed by GitHub
parent 424891516f
commit 0cb5e9bae0
15 changed files with 368 additions and 332 deletions

View File

@@ -14,7 +14,6 @@
*
\****************************************************************************/
#include "scimath.h"
#include "CCommand.h"
#include "EngineStrings.h"
#include "../Command.h"
@@ -24,6 +23,7 @@
#include "History.h" // for History Collector
#include "CalcInput.h"
#include "ICalcDisplay.h"
#include "scimath.h"
#include "Rational.h"
// The following are NOT real exports of CalcEngine, but for forward declarations