Share your repls and programming experiences

← Back to all posts
π in Zig and V
AmazingMech2418 (1102)

Here is a new addition to my series of pi approximations! This post includes approximations in Zig and V!

Here are the other approximations so far:
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! If adds COBOL, I am definitely looking forward to that one! Also, maybe Ada 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: Ada and anything else any of you come up with

Thank you to @Atias for the template!

By the way, the Zig program is accurate to 21 places! Most of them are only accurate to 15!

DynamicSquid (5023)

Can you try Night? I can provide you with a template :)

DynamicSquid (5023)

@AmazingMech2418 Actually, I don't think there's even a stable version for Night right now LOL! But once I release a stable version I can let you know :)

Warhawk947 (524)

this is a certified bobux moment

firefish (953)

@AmazingMech2418 he's off again making pi in languages that nobody has ever even heard of before