Sven Groot said:
I tried computing the value of the product using the highest value of k possible to see how fast it converges, using a 56 node cluster (I know there are better ways to compute something like this; doing it in a hopelessly convoluted way was kind of the point
here). The problem is, doubles aren't precise enough, and Math.Pow doesn't support decimals. Does anyone know a good, fast, high precision floating point library for .Net?
EDIT: Worked around the lack of Math.Pow by simply multiplying the value three times. Definitely more precise than double, but also a lot slower. Even on these 56 nodes it takes me about 3.5 minutes to calculate for k = 1 through 10,000,000,000. The same
scenario with double takes only 21 seconds, but yields a clearly different result.
Mind you, doing the same thing on my local machine would've taken roughly 7 hours.
Some results with various maximum values of k:
Max. value of k Formula value Execution time
100,000,000 5.9999998200000059999997770956 15s
10,000,000,000 5.9999999982000000009369275168 208s
50,000,000,000 5.9999999996400000005856836804 1069s
This is done using decimal. If that's precise enough, and my code has no bugs, we can conclude the product converges quite slowly. Again, this was done on a cluster with 56 nodes (most of which aren't very fast, though). Done locally, it wouldn't taken me
about 33 hours. Note that the 100,000,000 job (the first one) takes unnecessarily long because the system I'm using isn't optimized for short jobs.
There, I think I can now safely claim the most elaborate solution to this problem.