mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-21 22:03:11 -07:00
Rename DEFAULT_BASE to RATIONAL_BASE and set to Base10
This commit is contained in:
parent
a163095ac5
commit
4c8a48f4e4
3 changed files with 24 additions and 25 deletions
|
@ -213,7 +213,7 @@ namespace CalcEngine
|
|||
|
||||
try
|
||||
{
|
||||
lshrat(&lhsRat, rhsRat, DEFAULT_BASE, precision);
|
||||
lshrat(&lhsRat, rhsRat, RATIONAL_BASE, precision);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
|
@ -236,7 +236,7 @@ namespace CalcEngine
|
|||
|
||||
try
|
||||
{
|
||||
rshrat(&lhsRat, rhsRat, DEFAULT_BASE, precision);
|
||||
rshrat(&lhsRat, rhsRat, RATIONAL_BASE, precision);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
|
@ -264,7 +264,7 @@ namespace CalcEngine
|
|||
|
||||
try
|
||||
{
|
||||
andrat(&lhsRat, rhsRat, DEFAULT_BASE, precision);
|
||||
andrat(&lhsRat, rhsRat, RATIONAL_BASE, precision);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
|
@ -286,7 +286,7 @@ namespace CalcEngine
|
|||
PRAT rhsRat = rhs.ToPRAT();
|
||||
try
|
||||
{
|
||||
orrat(&lhsRat, rhsRat, DEFAULT_BASE, precision);
|
||||
orrat(&lhsRat, rhsRat, RATIONAL_BASE, precision);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
|
@ -308,7 +308,7 @@ namespace CalcEngine
|
|||
PRAT rhsRat = rhs.ToPRAT();
|
||||
try
|
||||
{
|
||||
xorrat(&lhsRat, rhsRat, DEFAULT_BASE, precision);
|
||||
xorrat(&lhsRat, rhsRat, RATIONAL_BASE, precision);
|
||||
destroyrat(rhsRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
|
@ -447,7 +447,7 @@ namespace CalcEngine
|
|||
uint64_t result;
|
||||
try
|
||||
{
|
||||
result = rattoUlonglong(rat, DEFAULT_BASE, precision);
|
||||
result = rattoUlonglong(rat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ Rational RationalMath::Frac(Rational const& rat, int32_t precision)
|
|||
PRAT prat = rat.ToPRAT();
|
||||
try
|
||||
{
|
||||
fracrat(&prat, DEFAULT_BASE, precision);
|
||||
fracrat(&prat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ Rational RationalMath::Integer(Rational const& rat, int32_t precision)
|
|||
PRAT prat = rat.ToPRAT();
|
||||
try
|
||||
{
|
||||
intrat(&prat, DEFAULT_BASE, precision);
|
||||
intrat(&prat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ Rational RationalMath::Pow(Rational const& base, Rational const& pow, int32_t pr
|
|||
|
||||
try
|
||||
{
|
||||
powrat(&baseRat, powRat, DEFAULT_BASE, precision);
|
||||
powrat(&baseRat, powRat, RATIONAL_BASE, precision);
|
||||
destroyrat(powRat);
|
||||
}
|
||||
catch (DWORD error)
|
||||
|
@ -80,7 +80,7 @@ Rational RationalMath::Fact(Rational const& rat, int32_t precision)
|
|||
|
||||
try
|
||||
{
|
||||
factrat(&prat, DEFAULT_BASE, precision);
|
||||
factrat(&prat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ Rational RationalMath::Exp(Rational const& rat, int32_t precision)
|
|||
|
||||
try
|
||||
{
|
||||
exprat(&prat, DEFAULT_BASE, precision);
|
||||
exprat(&prat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ Rational RationalMath::Sin(Rational const& rat, ANGLE_TYPE angletype, int32_t pr
|
|||
|
||||
try
|
||||
{
|
||||
sinanglerat(&prat, angletype, DEFAULT_BASE, precision);
|
||||
sinanglerat(&prat, angletype, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ Rational RationalMath::Cos(Rational const& rat, ANGLE_TYPE angletype, int32_t pr
|
|||
|
||||
try
|
||||
{
|
||||
cosanglerat(&prat, angletype, DEFAULT_BASE, precision);
|
||||
cosanglerat(&prat, angletype, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ Rational RationalMath::Tan(Rational const& rat, ANGLE_TYPE angletype, int32_t pr
|
|||
|
||||
try
|
||||
{
|
||||
tananglerat(&prat, angletype, DEFAULT_BASE, precision);
|
||||
tananglerat(&prat, angletype, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ Rational RationalMath::ASin(Rational const& rat, ANGLE_TYPE angletype, int32_t p
|
|||
|
||||
try
|
||||
{
|
||||
asinanglerat(&prat, angletype, DEFAULT_BASE, precision);
|
||||
asinanglerat(&prat, angletype, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ Rational RationalMath::ACos(Rational const& rat, ANGLE_TYPE angletype, int32_t p
|
|||
|
||||
try
|
||||
{
|
||||
acosanglerat(&prat, angletype, DEFAULT_BASE, precision);
|
||||
acosanglerat(&prat, angletype, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ Rational RationalMath::ATan(Rational const& rat, ANGLE_TYPE angletype, int32_t p
|
|||
|
||||
try
|
||||
{
|
||||
atananglerat(&prat, angletype, DEFAULT_BASE, precision);
|
||||
atananglerat(&prat, angletype, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ Rational RationalMath::Sinh(Rational const& rat, int32_t precision)
|
|||
|
||||
try
|
||||
{
|
||||
sinhrat(&prat, DEFAULT_BASE, precision);
|
||||
sinhrat(&prat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ Rational RationalMath::Cosh(Rational const& rat, int32_t precision)
|
|||
|
||||
try
|
||||
{
|
||||
coshrat(&prat, DEFAULT_BASE, precision);
|
||||
coshrat(&prat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -315,7 +315,7 @@ Rational RationalMath::Tanh(Rational const& rat, int32_t precision)
|
|||
|
||||
try
|
||||
{
|
||||
tanhrat(&prat, DEFAULT_BASE, precision);
|
||||
tanhrat(&prat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ Rational RationalMath::ASinh(Rational const& rat, int32_t precision)
|
|||
|
||||
try
|
||||
{
|
||||
asinhrat(&prat, DEFAULT_BASE, precision);
|
||||
asinhrat(&prat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
@ -355,7 +355,7 @@ Rational RationalMath::ACosh(Rational const& rat, int32_t precision)
|
|||
|
||||
try
|
||||
{
|
||||
acoshrat(&prat, DEFAULT_BASE, precision);
|
||||
acoshrat(&prat, RATIONAL_BASE, precision);
|
||||
}
|
||||
catch (DWORD error)
|
||||
{
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
namespace CalcEngine
|
||||
{
|
||||
// Default Base/Radix to use for Rational calculations
|
||||
// Defaults to base 64 rather than the RatPack-internal BASEX because many
|
||||
// calculations do not support bases > 64.
|
||||
static constexpr uint32_t DEFAULT_BASE = 64;
|
||||
// RatPack calculations currently support up to Base64.
|
||||
static constexpr uint32_t RATIONAL_BASE = 10;
|
||||
|
||||
class Rational
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue