diff --git a/ttmath/ttmathbig.h b/ttmath/ttmathbig.h index f319f52..c24b6ad 100644 --- a/ttmath/ttmathbig.h +++ b/ttmath/ttmathbig.h @@ -1254,14 +1254,14 @@ public: return 0; } - Big pow_frac( pow ); - pow_frac.RemainFraction(); + if( pow.exponent>-int(man*TTMATH_BITS_PER_UINT) && pow.exponent<=0 ) + { + Big 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); }