reverting r9177: pow() is a basic math function and should be used instead of a hack

This commit is contained in:
Mitchell Livingston 2010-05-31 13:43:33 +00:00
parent d1f5f2d37d
commit af2ae0eac4
1 changed files with 2 additions and 3 deletions

View File

@ -1342,9 +1342,8 @@ tr_parseNumberRange( const char * str_in, int len, int * setmeCount )
double
tr_truncd( double x, int decimal_places )
{
static const int multiplier[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000 };
const int64_t i = multiplier[decimal_places];
double x2 = (int64_t)(x*i);
const int i = (int) pow( 10, decimal_places );
double x2 = (int)(x*i);
return x2 / i;
}