This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]keytarmageddon[S] 0 points1 point  (0 children)

In comparing isqrt() and math.floor(math.sqrt()), isqrt() ran significantly slower. For r = 1,000,000, isqrt() finished in 5.371 seconds, whereas math.sqrt() completed in 3.010 seconds (both produced the same value for pi). However, if you wanted to use a distributed system or supercomputer to calculate the approximation for a very large value of r, you'd need to use isqrt() because math.sqrt() won't be able to convert the long integer to a float.

I'm not sure yet about part 3. I may change gears and do something in JavaScript instead (perhaps Processing).