fixed: (performance) in Big::LnSurrounding1() and Big::ExpSurrounding0()

we can copy 'old_value = *this' only when 'testing' is true


git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@160 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2009-06-14 18:45:36 +00:00
parent 9e42a5a9fd
commit 74553109a5
1 changed files with 18 additions and 13 deletions

View File

@ -1424,13 +1424,15 @@ public:
// there shouldn't be a carry here // there shouldn't be a carry here
Add( next_part ); Add( next_part );
if( testing && old_value==*this ) if( testing )
// we've added next few parts of the formula but the result {
// is still the same then we break the loop if( old_value == *this )
break; // we've added next few parts of the formula but the result
else // is still the same then we break the loop
old_value = *this; break;
else
old_value = *this;
}
// we set the denominator and the numerator for a next part of the formula // we set the denominator and the numerator for a next part of the formula
if( denominator_i.Add(one) ) if( denominator_i.Add(one) )
@ -1591,12 +1593,15 @@ public:
// there shouldn't be a carry here // there shouldn't be a carry here
Add(next_part); Add(next_part);
if( testing && old_value == *this ) if( testing )
// we've added next (step_test) parts of the formula but the result {
// is still the same then we break the loop if( old_value == *this )
break; // we've added next (step_test) parts of the formula but the result
else // is still the same then we break the loop
old_value = *this; break;
else
old_value = *this;
}
if( x1.Mul(x2) ) if( x1.Mul(x2) )
// if there is a carry here the result we return as good // if there is a carry here the result we return as good