π in Bash
AmazingMech2418 (941)

I think I'm pretty much doing pi approximations in every language now, so, here it is in the classic Linux shell: Bash!

Here are the other approximations so far:
Kotlin - https://repl.it/talk/share/p-in-Kotlin/36125
Ruby - https://repl.it/talk/share/p-in-Ruby/34982
Java - https://repl.it/talk/share/p-in-Java/34978
QBasic - https://repl.it/talk/share/p-in-QBasic/34973
Fortran - https://repl.it/talk/share/p-in-Fortran/34890
APL - https://repl.it/talk/share/p-in-APL/34888
Forth - https://repl.it/talk/share/p-in-Forth/34652
LOLCODE - https://repl.it/talk/share/p-in-LOLCODE/34421
Python and Node.js (Node is linked in post) - https://repl.it/talk/share/2-Approximations-of-p-In-Only-Four-Lines-of-Code/32773
C - https://repl.it/talk/share/p-Approximations-in-C/33461

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

Note: Bash is SLOW

You are viewing a single comment. View All
NoelB33 (314)

I think repl.it is down, I can’t access any repls but I’ll try it later!

AmazingMech2418 (941)

@NoelBryan I think it is. @AtriDey is having the issues too.

AtriDey (170)

@AmazingMech2418 @NoelBryan I reported it, but I'm taking it down since there are dozens of other reports already and the repl.it team is struggling as is.

NoelB33 (314)

The repl works now! Bash is slow, your right, but that’s really cool!

NoelB33 (314)

If you want another language, do scheme @AmazingMech2418

AmazingMech2418 (941)

@NoelBryan I said I was going to save Lisp dialects for last... Also, I am about to post C#.

NoelB33 (314)

Oh, idk what scheme actually is lol @AmazingMech2418

AmazingMech2418 (941)

@NoelBryan Scheme and Clojure are Lisp dialects.

Code1Tech (88)

cool! im also working on c#. im learning the basics so i can use unity!
@AmazingMech2418