I am having the following problem. The program functions perfectly for smaller values. I have successfully tested the program against primes and composites of 10 digits with no errors. However, when I start testing larger primes, I find the following as a barrier:
Numbers start being reformatted. x becomes xEy (example: 1.8946456813E24). This causes loss of precision in the floor comparison. This loss of precision results in a false factorization of the number, and labels a proven prime as a composite.
I am currently using the double type for the value. This obviously comes with limitations. I am not aware of any primitive type that will allow the rather large values I am planning to test to work (numbers of 20+ digits, both integer and decimal).
Is there a different numeric type, be it a reference or class method type, that will allow working with very large numbers without the xEy reformatting? This would be most helpful for this program and the next program; a prime number generator... (it's a part of my next chapter on indexing and a revisit on prime theorems.)
Number of downloads: 191