fixed: Big::Pow(const Big<exp, man> & pow)

it's using PowInt() only when pow.exponent is in range (-man*TTMATH_BITS_PER_UINT; 0]
       previously the powering 'hung' on an input like this: "(1+ 1e-10000) ^ 10e100000000"
       (the was 10e100000000 iterations in PowInt())


git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@108 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2009-03-25 01:12:00 +00:00
parent 5668fbecf5
commit bfdc6d3df3
1 changed files with 7 additions and 7 deletions

View File

@ -1254,14 +1254,14 @@ public:
return 0;
}
Big<exp, man> pow_frac( pow );
pow_frac.RemainFraction();
if( pow.exponent>-int(man*TTMATH_BITS_PER_UINT) && pow.exponent<=0 )
{
Big<exp, man> pow_frac( pow );
pow_frac.RemainFraction();
if( pow_frac.IsZero() )
return PowInt( pow );
// pow is with fraction (not integer)
// result = e^(pow * ln(this) ) where 'this' must be greater than 0
if( pow_frac.IsZero() )
return PowInt( pow );
}
return PowFrac(pow);
}