diff --git a/CHANGELOG b/CHANGELOG index 9d11e93..10c2f3c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/ttmath/ttmathparser.h b/ttmath/ttmathparser.h index e657a9d..5829e0b 100644 --- a/ttmath/ttmathparser.h +++ b/ttmath/ttmathparser.h @@ -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::BitXor); InsertFunctionToTable("sum", &Parser::Sum); InsertFunctionToTable("avg", &Parser::Avg); + InsertFunctionToTable("frac", &Parser::Frac); }