Share your repls and programming experiences

← Back to all posts
π in COBOL
AmazingMech2418 (1102)

Here is a new addition to my series of pi approximations! This one is in COBOL!

Here are the other approximations so far:
Ada -
Zig + V -
Prolog -
Haxe -
Objective-C -
Pascal -
D -
Scala -
Reason -
Tcl -
C++ -
TypeScript -
CoffeeScript -
Elisp -
Clojure -
Scheme -
Erlang -
Elixir -
Julia -
Nim -
Crystal -
F# -
Lua -
Dart -
R -
Haskell -
Raku -
Rust -
Go -
Swift -
C# -
Bash -
Kotlin -
Ruby -
Java -
QBasic -
Fortran -
Forth -
Python and Node.js (Node is linked in post) -
C -

Credit to @NoelB33 @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).

This series is mostly over, but if I learn a new programming language that has floating point capabilities, get ready for a new addition! I have learned Assembly (GAS and NASM), BrainF, and Quil, but these ones don't support floating point in an easy-enough way. LOL! Which one should I do next? Let me know what you think!

Also, I'm planning on making a powerful compiled language called Peregrine soon and an object-oriented variant called Falcon and will make pi approximations in both to add to the series!

Ideas for the next ones: Open to suggestions!

Also, thank you to @DynamicSquid for most recently suggesting COBOL on my post in Ada.

JacobMcPherson1 (239)

You should do one in J

Whippingdot (678)

my brain does not comprehend the words you are speaking oh amazing mech who wants to take over the world of fortnite @AmazingMech2418

fuzzyastrocat (1867)

Dang I need to make faster progress on Eros so I can get you to do one of these in it xD

Nicely done (though ewww COBOL)!

AmazingMech2418 (1102)

@fuzzyastrocat Thank you! Hey, COBOL is actually pretty cool, I think! LOL!

RayhanADev (2590)

Yay! Another one in the series :D

Also have you done BASIC? (not QBasic which I know you know, just BASIC)


  • Applescript
  • WASM
  • HolyC
AmazingMech2418 (1102)

@RayhanADev Thank you! :D

And I have not done one in normal BASIC, but really the main difference between the two is that BASIC has the GUI, and a pi approximator doesn't really need that...

RayhanADev (2590)

@AmazingMech2418 ah gotcha (also I updated comment with a few random languages off the top of my head lol)

AmazingMech2418 (1102)

@RayhanADev With AppleScript, I'm pretty sure that's Mac-only, so I don't think I can do it on and I can't do it off because I don't have a Mac.

WASM is actually one I'm thinking about trying! I need to learn it a little more though.

Judging from a few Google searches, that one only runs on TempleOS...

EpicGamer007 (1752)

@AmazingMech2418 @RayhanADev wasm is a compile target, i think you meant wat. (I dont think AM2418 would want to write machine code lol)