Live data from Hacker News

Multiple ways to compute e in Raku

blogs.perl.org

11–20 of 41 posts

Re: Multiple ways to compute e in Raku

#11
> 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".

Re: Multiple ways to compute e in Raku

#12
post #6

This looks surprisingly neat, honestly. I've never used Perl, let alone Perl 6, but I think I see why people cared about it.

Is it officially appropriate to talk about Perl in the past tense?

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".

Re: Multiple ways to compute e in Raku

#13
I can't connect to this page, as Firefox is automatically redirecting me to the HTTPS version of the page even though it's not supported. I guess I don't run into this that often given how common HTTPS is, but maybe someone else has this problem with this site? If you are, have you fixed it before? I've tried all of the methods mentioned on this[0] page, and I'm on Firefox 70 on Linux Mint.

[0]: https://stackoverflow.com/questions/30532471/firefox-redirec...

Re: Multiple ways to compute e in Raku

#14
Why does the Bernoulli formula take exponentially long in the exponent? Python’s native form (using either an integer or float exponent) and even an arbitrary percision computation to 1000 decimal digits using mpmath (also with either an integer or float exponent) are fast even for much larger exponents, and are accurate.

   >>> import math, timeit
   >>> x = 2**52
   >>> math.e
   2.718281828459045

   >>> (1+1/x)**x
   2.718281828459045
   >>> timeit.timeit(lambda: (1+1/x)**x, number = 10**6) / 10**6
   2.1324560802895575e-07
   >>> timeit.timeit(lambda: (1+1/x)**float(x), number = 10**6) / 10**6
   3.0082468304317444e-07

   >>> from mpmath import mp
   >>> mp.dps = 1000
   >>> (1+1/mp.mpf(x))**x
   mpf(‘2.7182818284590449335703801338125114…’)
   >>> timeit.timeit(lambda: (1+1/mp.mpf(x))**x, number = 10**3) / 10**3
   0.0004724335519131273
   >>> timeit.timeit(lambda: (1+1/mp.mpf(x))**mp.mpf(x), number = 10**3) / 10**3
   0.00047394841397181155
(Times in seconds.)

Re: Multiple ways to compute e in Raku

#15
post #8

This article is a love letter to both mathematics and programming. It is awesome to read something and grasp the joy and playfulness of the author. The maths are explained in a simple way. The programming concepts go from the straightforward to the delightfully weird (and let't not kid ourselves, Raku shines the most the weirder things get). And the final result is downright fun. I love it.

Damian is a magician in the way how he teaches different subjects. His talk on calculating PI was fun too.

Re: Multiple ways to compute e in Raku

#16
post #6

This looks surprisingly neat, honestly. I've never used Perl, let alone Perl 6, but I think I see why people cared about it.

Is it officially appropriate to talk about Perl in the past tense?

No. Perl and Raku are different, albeit related, languages.

Re: Multiple ways to compute e in Raku

#17
post #6

This looks surprisingly neat, honestly. I've never used Perl, let alone Perl 6, but I think I see why people cared about it.

Is it officially appropriate to talk about Perl in the past tense?

I wouldn't read too much into it. "X is dead" is such a common sentiment on HN it's somewhere between funny and tiresome.

Re: Multiple ways to compute e in Raku

#18
post #12
post #6

Earlier quoted context omitted.

Is it officially appropriate to talk about Perl in the past tense?

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"?

Re: Multiple ways to compute e in Raku

#19

I can't connect to this page, as Firefox is automatically redirecting me to the HTTPS version of the page even though it's not supported. I guess I don't run into this that often given how common HTTPS is, but maybe someone else has this problem with this site? If you are, have you fixed it before? I've tried all of the methods mentioned on this[0] page, and I'm on Firefox 70 on Linux Mint. [0]: https://stackoverflow…

Are you sure it's Firefox doing that? I've got 70.0.1 on macOS and it's displaying fine (with the red crossed out padlock in the address bar).

You sure you don't have HTTPS-Everywhere or something similar running?

(There's noting in the response headers or html meta tags that look like it'd be redirecting you too https there...)

Post reply on HN