Share your repls and programming experiences

← Back to all posts
π in Raku
AmazingMech2418 (1046)

I think I'm pretty much doing pi approximations in every language now, so, here it is in Raku/Perl 6!

I was going to do NASM before Raku, but ran into some issues with floating point numbers that I'm currently working on fixing.

Here are the other approximations so far:
Rust -
Go -
Swift -
C# -
Bash -
Kotlin -
Ruby -
Java -
QBasic -
Fortran -
Forth -
Python and Node.js (Node is linked in post) -
C -

Credit to @NoelBryan, @TheForArkLD , @Warhawk947 , and @LizFoster for inspiring these approximations. Most of these use the Nilakantha Series, although I also use the arctangent method (multiplying the radian arctangent of 1 by 4 to get pi and getting the arctangent with an infinite series) in three of them (Python, Node, and C).

Also, credit to @theangryepicbanana for inspiring this approximation in Raku!

Next up is NASM (Assembly; only if I can actually figure it out. I might have to save it for later since it is so difficult to program in), followed by Haskell, followed by R, followed by Dart. If you have any suggestions for after those, please let me know!

AmazingMech2418 (1046)

@TheForArkLD Thank you! Though, right now, I'm trying to fix some things in NASM so I can do that one next. If that doesn't work, I'll just skip on to Haskell, and then R, and then Dart, and then I could do J.