I have a function that takes a long and finds the factors of it. It works for small numbers (the highest I've tested is 1234567), after which it gives me a windows error. The numbers are within the bounds of a long on my machine (2147483647), and I do not understand why it is giving me these errors. I'm using WinXP SP2, wxDev-C++ w/ MinGW. My code is attached.