Share your repls and programming experiences

← Back to all posts
[PI Day2021] 14 ways for approximating PI
potatojs

hi

hello there

how it works

so you have the stop and run buttons which are used to stop or continue running an algorithm

14 ways of calculating PI

these are 14 ways of calculating PI 10 infinite series which all are gorgeous, and then 4 random ways i liked the most.

why 14?

well i planned on making 31.4 ways of calculating PI but i wanna share this on PIDay and i just started yesterday so i didn't have that much time
i switched to 14 because 3.14 you know, PI day 2022 i guess?

Disclaimer

the infinite series can't go more than a certain accuracy because of float-point precision and stuff which i don't know how to fix in javascript :)
and also this isn't meant to be special or good, it's just a milestone that i'm gonna later look back at it and say
"yeah i was a damn beginner" hopefully :D

edit

lol i just remembered how broken the replit sharing place is..

Voters
CHRISTIANMATTHY
rickysong
maxina
CodingElf66
MarcusWeinberger
JBloves27
FloCal35
CodingGoose
pythonPOG
AgastyaSandhuja
Comments
hotnewtop
Coder100

pogger

CHRISTIANMATTHY

i made a series too :). it converges horribly but it works. heres an image of the series (you can't see it very well if you're on dark, but it's below. save the image and then open it to see it well)

CHRISTIANMATTHY

also what about Gauss-Legendre and Archimedes' method @CHRISTIANMATTHY

potatojs

@CHRISTIANMATTHY lmao i know (almost) nothing about these, most of them i just copied from wikipedia i did'nt really study about there history

Whippingdot

POG

Also I luv these _random ways to calculate pie

potatojs

@Whippingdot thanks :D

OldWizard209

potato attaccccc
potatoo proteccc

BUT MOST IMPORTANTLY

POTATO COIME BACCCC

JBloves27

lmao yes @OldWizard209

CodingElf66

This is pi based on my code: 3.141592653589788

potatojs

@JeffreyChen13 yep it doesn't go more precise then that because of floating point precision and stuff which is really sad :(
i may try creating my own big float class that contains a bigint in it but i think that's gonna be really hard

CodingElf66

@potatojs Great! When you do, please notify me, I would definetly upvote it, and test it!

potatojs
CodingElf66

@potatojs Thanks!

CodingElf66

@potatojs Thanks!

NoNameByProgram

noice someday people will know irrational pi

here's what i know: 3.14159265358979323846623383279502884197169393751

potatojs

@NoNameByProgram ohhh that's cool, i wish i was that smart but my potato brain can't handle that much data :D

YuvanVighnesh

3.141592653589 is all I know :(

potatojs

@YuvanVighnesh lol i know 3.141592653589793 :)

YuvanVighnesh

nice @potatojs

FlaminHotValdez

@YuvanVighnesh I know 3.1415926

pi is overrated e shall rule
YuvanVighnesh

begone unholy demon

@FlaminHotValdez

FlaminHotValdez

@YuvanVighnesh

BE GONE NON OLYMPIAN WORSHIPPER

GO ROT IN TARTARUS

YuvanVighnesh
FlaminHotValdez
YuvanVighnesh
FlaminHotValdez

@YuvanVighnesh

You gotta think outside the box bro

I present to you...

The ultimate negator card....

UNO SKIP!

YuvanVighnesh
potatojs

@FlaminHotValdez lol well yes and no