Talk:Pi

From Rosetta Code
Revision as of 22:34, 23 July 2011 by rosettacode>Markhobley (Deleted GUISS solution)

Why "until a key is pressed"? That's an annoyingly non-portable construct. --Rdm 22:20, 25 March 2011 (UTC)

I wrote the break key. Someone else wrote "until a key is pressed". The idea is that the process runs for infinity unless the process is terminated. I have reverted the wording to say "the break key".

Markhobley 22:40, 25 March 2011 (UTC)

Using a keyboard is non-portable? The break key is less portable. I changed it to any key to try to make it more general. Really it should just go forever if you want it to be portable. In general, portability is not necessarily a concern here I don't think. --Mwn3d 02:15, 26 March 2011 (UTC)

I agree. There are computers without a keyboard, and special industrial keyboards with the break key removed. If there is no facility to terminate the process, then it should run for infinity for the purposes of this task. I have updated the wording to clarify this point.

Markhobley 10:57, 26 March 2011 (UTC)

I take it that you are looking for until the process is terminated, in whatever way is normal for the environment, not necessarily with a key labeled “Break”. I have updated the task description to clarify this. —Kevin Reid 13:35, 27 March 2011 (UTC)

Why request "continue for infinity"? There are no computer that has infinity memory so that request will simply not be possible. A practical limit "continue as long as possible" could make more sense. --<Jofur> 11:02, 26 March 2011 (UTC)

Indeed. Infinity here means until the limits of the computer are reached. (So on a system that uses 32 bit registers, calculations would probably cease after 4294967295 digits, unless big numbering was used.)

Markhobley 15:54, 26 March 2011 (UTC)

There are basiclly two ways to calculate Pi that I know of; #1, (traditional) to calculate the sequence in a row & #2 (BBP-Formual) that calculates specific digits in base-16... Both needs huge amount of memory and if you aim for 'infinity' the #1 system will likely crash due to the data arrays and #2 due to the huge polynoms used for the smallest fractions - neither will give anything close to 4294967295 digits on a 32-bit system.
If to behave nice, maybe the program should end before it crash? --<Jofur> 16:28, 26 March 2011 (UTC)

How?

The task should provide at least one method for doing such a calculation I think? --Paddy3118 17:10, 26 March 2011 (UTC)

I left this open for the coder to decide at this stage, but I would probably use bbp to obtain each consecutive digit. (We could always split the task for different methodologies in future).

Markhobley 21:21, 26 March 2011 (UTC)

It can still be left up to the programmer, but maybe offer some suggestions with pseudocode? People don't have to generate infinite digits of pi very often. They probably don't have algorithms lying around in their brains. --Mwn3d 21:25, 26 March 2011 (UTC)
There's an algorithm that allows you to calculate a specific digit of pi. I'd google it, but I'm about to head out the door. It might be possible to memoize some of the intermediate values. --Michael Mol 13:36, 27 March 2011 (UTC)
bbp? --Paddy3118 22:46, 26 March 2011 (UTC)

Deleted GUISS solution

GUISS uses the desktop calculator for this task, and produces the maximum number of digits that the desktop calculator produces. ("Forever" in computing terms means until the maximum value of the registers is reached, or resources are exhausted, rather than "forever" as in the life of the Universe). The GUISS solution provided the closest approximate fit based on its capabilities. Maybe I should have stuck a note that the solution provided produces as many digits as possible for the implementation. (It is not possible to get more digits). The solution was deleted, but I will restore it and pin a note. Markhobley 22:34, 23 July 2011 (UTC)