Optimize stop factor after every found factor
This commit is contained in:
parent
5946e3ac82
commit
cff0316c0a
1 changed files with 10 additions and 0 deletions
|
@ -185,6 +185,16 @@ void FactorizationController::factorize() {
|
||||||
emit factorsChanged();
|
emit factorsChanged();
|
||||||
emit curFactNumberChanged();
|
emit curFactNumberChanged();
|
||||||
|
|
||||||
|
// As a further optimization, we can adjust the stop factor to the sqrt of
|
||||||
|
// the new number being factorized, rather than keeping it at the original number.
|
||||||
|
// (This might make the progress bar jump radically)
|
||||||
|
if (m_useSqrtOptimization) {
|
||||||
|
m_stopFactor = static_cast<long long>(std::sqrt(m_currentFactNumber));
|
||||||
|
} else {
|
||||||
|
m_stopFactor = m_currentFactNumber - 1;
|
||||||
|
}
|
||||||
|
emit progressChanged();
|
||||||
|
|
||||||
// Don't increase current factor, keep dividing by it until no longer divisible
|
// Don't increase current factor, keep dividing by it until no longer divisible
|
||||||
} else {
|
} else {
|
||||||
m_currentFactor++;
|
m_currentFactor++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue