mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Add comments
This commit is contained in:
parent
4908efcb96
commit
c546c13d0b
3 changed files with 6 additions and 11 deletions
|
@ -114,12 +114,13 @@ CalcEngine::Rational CCalcEngine::DoOperation(int operation, CalcEngine::Rationa
|
||||||
{
|
{
|
||||||
if (m_fIntegerMode)
|
if (m_fIntegerMode)
|
||||||
{
|
{
|
||||||
// Programmer mode
|
// Programmer mode, use remrat (remainder after division)
|
||||||
iFinalSign = iNumeratorSign;
|
iFinalSign = iNumeratorSign;
|
||||||
result %= temp;
|
result %= temp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//other modes, use modrat (modulus after division)
|
||||||
iFinalSign = iDenominatorSign;
|
iFinalSign = iDenominatorSign;
|
||||||
result = Mod(result, temp);
|
result = Mod(result, temp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,11 +92,9 @@ void asinanglerat( _Inout_ PRAT *pa, ANGLE_TYPE angletype, uint32_t radix, int32
|
||||||
void asinrat( PRAT *px, uint32_t radix, int32_t precision)
|
void asinrat( PRAT *px, uint32_t radix, int32_t precision)
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t sgn;
|
|
||||||
PRAT pret= nullptr;
|
PRAT pret= nullptr;
|
||||||
PRAT phack= nullptr;
|
PRAT phack= nullptr;
|
||||||
|
int32_t sgn = SIGN(*px);
|
||||||
sgn = SIGN(*px);
|
|
||||||
|
|
||||||
(*px)->pp->sign = 1;
|
(*px)->pp->sign = 1;
|
||||||
(*px)->pq->sign = 1;
|
(*px)->pq->sign = 1;
|
||||||
|
@ -204,9 +202,7 @@ void _acosrat( PRAT *px, int32_t precision)
|
||||||
void acosrat( PRAT *px, uint32_t radix, int32_t precision)
|
void acosrat( PRAT *px, uint32_t radix, int32_t precision)
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t sgn;
|
int32_t sgn = SIGN(*px);
|
||||||
|
|
||||||
sgn = SIGN(*px);
|
|
||||||
|
|
||||||
(*px)->pp->sign = 1;
|
(*px)->pp->sign = 1;
|
||||||
(*px)->pq->sign = 1;
|
(*px)->pq->sign = 1;
|
||||||
|
@ -291,10 +287,8 @@ void _atanrat( PRAT *px, int32_t precision)
|
||||||
void atanrat( PRAT *px, uint32_t radix, int32_t precision)
|
void atanrat( PRAT *px, uint32_t radix, int32_t precision)
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t sgn;
|
|
||||||
PRAT tmpx= nullptr;
|
PRAT tmpx= nullptr;
|
||||||
|
int32_t sgn = SIGN(*px);
|
||||||
sgn = SIGN(*px);
|
|
||||||
|
|
||||||
(*px)->pp->sign = 1;
|
(*px)->pp->sign = 1;
|
||||||
(*px)->pq->sign = 1;
|
(*px)->pq->sign = 1;
|
||||||
|
|
|
@ -236,7 +236,7 @@ void remrat(PRAT *pa, PRAT b)
|
||||||
|
|
||||||
void modrat(PRAT *pa, PRAT b)
|
void modrat(PRAT *pa, PRAT b)
|
||||||
{
|
{
|
||||||
//contrary to remrat, modrat(a, 0) must return a
|
//contrary to remrat(X, 0) returning 0, modrat(X, 0) must return X
|
||||||
if (zerrat(b))
|
if (zerrat(b))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue