Hi all,
This is my first post here - so apologies if I don't write things in the best way.
Basically I'm writing a short VBA program to determine all of the prime factors of a given number (let's call this x). I'm pretty happy with the general logic but one thing I'm struggling on is a step where I determine whether or not a number (from 1 to sqrt(X)) is a factor.
Originally, I did:
If x/i = round(x/i,0) Then [...]
Which worked until x was > 2.1b (the maximum Long number), however x was defined as Single or Double.
Next, I then looked to:
If x mod i = 0 Then [...]
And the mod function seemed a lot quicker, but again broken when x exceeded the maximum Long value, despite being defined as Single or Double.
I might be missing something obvious here, but would love to know of any solutions to get around this, as I think the logic is sound.
Thanks!
Alex
Bookmarks