added: bool Parser::Calculated()
this method returns true is something was calculated (at least one mathematical operator was used or a function or variable) git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@207 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
32ebbbfd9e
commit
02da809583
|
@ -1,4 +1,4 @@
|
|||
Version 0.9.0 prerelease (2009.10.03):
|
||||
Version 0.9.0 prerelease (2009.10.13):
|
||||
* fixed: Big::operator>>(std::istream&, Big<> &) didn't recognize values
|
||||
in scientific mode (with 'e' character)
|
||||
* fixed: UInt::SetBitInWord(uint & value, uint bit) set 1 if the bit was
|
||||
|
@ -32,6 +32,9 @@ Version 0.9.0 prerelease (2009.10.03):
|
|||
* added: macro: TTMATH_BITS(min_bits)
|
||||
which returns the number of machine words
|
||||
capable to hold min_bits bits
|
||||
* added: bool Parser::Calculated()
|
||||
this method returns true is something was calculated
|
||||
(at least one mathematical operator was used or a function or variable)
|
||||
* changed: Factorial() is using the Gamma() function now
|
||||
* changed: Big::Div(ss2)
|
||||
Big::Mod(ss2)
|
||||
|
|
|
@ -438,6 +438,11 @@ CGamma<ValueType> cgamma;
|
|||
std::string wide_to_ansi;
|
||||
|
||||
|
||||
/*!
|
||||
true if something was calculated (at least one mathematical operator was used or a function or a variable)
|
||||
*/
|
||||
bool calculated;
|
||||
|
||||
/*!
|
||||
we're using this method for reporting an error
|
||||
*/
|
||||
|
@ -566,6 +571,7 @@ bool GetValueOfUserDefinedVariable(const std::string & variable_name,ValueType &
|
|||
return false;
|
||||
|
||||
result = RecurrenceParsingVariablesOrFunction(true, variable_name, string_value);
|
||||
calculated = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -614,6 +620,7 @@ ValueType result;
|
|||
Error( err_unknown_variable );
|
||||
|
||||
(result.*(i->second))();
|
||||
calculated = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1432,6 +1439,7 @@ bool GetValueOfUserDefinedFunction(const std::string & function_name, int amount
|
|||
}
|
||||
|
||||
stack[sindex-1].value = RecurrenceParsingVariablesOrFunction(false, function_name, string_value, &local_variables);
|
||||
calculated = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1464,6 +1472,7 @@ void CallFunction(const std::string & function_name, int amount_of_args, int sin
|
|||
calling the specify function
|
||||
*/
|
||||
(this->*(i->second))(sindex, amount_of_args, stack[sindex-1].value);
|
||||
calculated = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1983,6 +1992,8 @@ void MakeStandardMathematicOperation(ValueType & value1, typename MatOperator::T
|
|||
{
|
||||
uint res;
|
||||
|
||||
calculated = true;
|
||||
|
||||
switch( mat_operator )
|
||||
{
|
||||
case MatOperator::land:
|
||||
|
@ -2540,7 +2551,8 @@ ErrorCode Parse(const char * str)
|
|||
stack_index = 0;
|
||||
pstring = str;
|
||||
error = err_ok;
|
||||
|
||||
calculated = false;
|
||||
|
||||
stack.resize( default_stack_size );
|
||||
|
||||
try
|
||||
|
@ -2550,6 +2562,7 @@ ErrorCode Parse(const char * str)
|
|||
catch(ErrorCode c)
|
||||
{
|
||||
error = c;
|
||||
calculated = false;
|
||||
}
|
||||
|
||||
NormalizeStack();
|
||||
|
@ -2587,6 +2600,21 @@ ErrorCode Parse(const std::wstring & str)
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
this method returns true is something was calculated
|
||||
(at least one mathematical operator was used or a function or variable)
|
||||
e.g. the string to Parse() looked like this:
|
||||
"1+1"
|
||||
"2*3"
|
||||
"sin(5)"
|
||||
|
||||
if the string was e.g. "678" the result is false
|
||||
*/
|
||||
bool Calculated()
|
||||
{
|
||||
return calculated;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue