added: to the parser: function frac() - remains fraction

git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@230 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2009-11-01 14:20:48 +00:00
parent cccf82797f
commit 4f1763d773
2 changed files with 11 additions and 0 deletions

View File

@ -45,6 +45,7 @@ Version 0.9.0 prerelease (2009.11.01):
uint FromString(const std::string & string, const Conv & conv, const wchar_t **, bool *)
uint FromString(const std::wstring & string, const Conv & conv, const wchar_t **, bool *)
* added: UInt::Sqrt() - a new algorithm for calculating the square root
* added: to the parser: function frac() - remains fraction
* changed: Factorial() is using the Gamma() function now
* changed: Big::Div(ss2)
Big::Mod(ss2)

View File

@ -1390,6 +1390,15 @@ void Avg(int sindex, int amount_of_args, ValueType & result)
}
void Frac(int sindex, int amount_of_args, ValueType & result)
{
if( amount_of_args != 1 )
Error( err_improper_amount_of_arguments );
result = stack[sindex].value;
result.RemainFraction();
}
@ -1596,6 +1605,7 @@ void CreateFunctionsTable()
InsertFunctionToTable("bxor", &Parser<ValueType>::BitXor);
InsertFunctionToTable("sum", &Parser<ValueType>::Sum);
InsertFunctionToTable("avg", &Parser<ValueType>::Avg);
InsertFunctionToTable("frac", &Parser<ValueType>::Frac);
}