Earlier quoted context omitted.
Perl 5 will continue to be the official "Perl". Development on that continues, and it has an extensive community, though not nearly as large as Python, which was once its peer. What was Perl 6 will, moving forward, be known as "Raku".
Is that a "yes it is"?
Multiple ways to compute e in Raku
21–30 of 41 posts
Re: Multiple ways to compute e in Raku
#22Let's say you want to deal with numbers to 1000 decimal places. Pick a base that is a power of 10, such as 10000. Represent a number as an array of 251 base 10000 digits, with the first item of the array being the integer part, and the remaining 250 being 250 base 10000 "decimal" digits.
You need two of these arrays. One represents 1/n!, and the other is the cumulative sum of the series so far.
You need two large precision operations. To go from 1/n! to 1/(n+1)! involves simply dividing by n+1. As long as we limit n+1 to under 10000, we only have to handle division with a single digit denominator. Limiting n thusly is not a problem--it's enough to actually support calculating e to over 35000 decimal places, so our modest goal of 1000 is no problem.
Implement the division exactly like you would do division by a single digit with pencil and paper. The only thing you have to worry about is dealing with carry. You can have intermediate values as large as the carry x the base + base - 1, and since carry can be as large as base - 1, this means you can have intermediate values as large as base^2 - 1. Just pick base (10000 in my example) so that base^2 - 1 doesn't overflow the basic integer type of the language you are using.
The other large precision operation you need is addition, to accumulate the result from the division into the sum. Same as with division--just write it using the same algorithm you would use with pencil and paper. Add digits right to left, with carry.
By using a base that is a power of 10, it is easy to figure out the base 10 representation of the final result for printing.
Re: Multiple ways to compute e in Raku
#23> Maksymilian Piskorowski found that if you happen to have a spare eight 9s, you can compute 𝑒 = (9/9 + 9^(-9^9))^(9^(9^9)), which is accurate to a little over 369 million decimal places. Sure, because 9/9 = 1 and if you take x = 9^9^9, you get back (1 + x^(-1))^x, i.e. the first formula. It's cute, but I don't know if you could call it a "discovery".
He did in fact build up (1 + x^(-1))^x to slowly increase the accuracy of the formula.
[0] https://www2.stetson.edu/~efriedma/mathmagic/0804.html (The page may say 2004, but has been actively updated, and has references to 2019.)
Re: Multiple ways to compute e in Raku
#24This looks surprisingly neat, honestly. I've never used Perl, let alone Perl 6, but I think I see why people cared about it.
Re: Multiple ways to compute e in Raku
#25Re: Multiple ways to compute e in Raku
#26Earlier quoted context omitted.
Is it officially appropriate to talk about Perl in the past tense?
No, just about people caring about it. (Okay, that was flip, but Perl has really lost its niche, and not many people are very excited about it now.)
Re: Multiple ways to compute e in Raku
#27Earlier quoted context omitted.
No, just about people caring about it. (Okay, that was flip, but Perl has really lost its niche, and not many people are very excited about it now.)
Nah, plenty of people still care about it (I should know, I'm one of them!). And with regular expressions front-and-center in perl, I still find it wonderful for text munging.
Re: Multiple ways to compute e in Raku
#28Re: Multiple ways to compute e in Raku
#29I'd rather there was a single way to do something useful in Raku than multiple ways to do something completely useless.
Re: Multiple ways to compute e in Raku
#30Earlier quoted context omitted.
Is it officially appropriate to talk about Perl in the past tense?
I think technically yes, because the present tense should be referring to Raku instead.