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:
parent
5668fbecf5
commit
bfdc6d3df3
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue