Skip to content

Commit

Permalink
fix factorization bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Jul 14, 2024
1 parent a1a5a20 commit 040246c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/lumatone_editor_library/common/math.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

const double PI = 3.14159265359f;

static int PRIMES[100] = {
#define LTN_MAX_PRIMES 100

static int PRIMES[LTN_MAX_PRIMES] = {
2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
Expand Down Expand Up @@ -105,7 +107,7 @@ static juce::Array<int> getFactors(int numIn)

double factorized = numIn;

int maxPrime = (int)sqrt(numIn);
int maxPrime = PRIMES[LTN_MAX_PRIMES - 1];

while (factorized > 1.0)
{
Expand Down

0 comments on commit 040246c

Please sign in to comment.