Skip to content
← Back to Community
[PI Day2021] 14 ways for approximating PI
Profile icon
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
Profile icon
CHRISTIANMATTHY
Profile icon
rickysong
Profile icon
maxina
Profile icon
CodingElf66
Profile icon
MarcusWeinberger
Profile icon
JBloves27
Profile icon
FloCal35
Profile icon
CodingGoose
Profile icon
pythonPOG
Profile icon
AgastyaSandhuja
Comments
hotnewtop
Profile icon
Coder100

pogger

Profile icon
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)
image

Profile icon
CHRISTIANMATTHY

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

Profile icon
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

Profile icon
Whippingdot

POG

Also I luv these _random ways to calculate pie
image

Profile icon
potatojs

@Whippingdot thanks :D

Profile icon
OldWizard209

potato attaccccc
potatoo proteccc

BUT MOST IMPORTANTLY

POTATO COIME BACCCC

Profile icon
JBloves27
Profile icon
CodingElf66

This is pi based on my code: 3.141592653589788

Profile icon
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

Profile icon
CodingElf66

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

Profile icon
potatojs
Profile icon
CodingElf66

@potatojs Thanks!

Profile icon
CodingElf66

@potatojs Thanks!

Profile icon
NoNameByProgram

noice someday people will know irrational pi

here's what i know: 3.14159265358979323846623383279502884197169393751

Profile icon
potatojs

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

Profile icon
YuvanVighnesh

3.141592653589 is all I know :(

Profile icon
potatojs

@YuvanVighnesh lol i know 3.141592653589793 :)

Profile icon
YuvanVighnesh
Profile icon
FlaminHotValdez

@YuvanVighnesh I know 3.1415926

pi is overrated e shall rule
Profile icon
YuvanVighnesh
Profile icon
FlaminHotValdez

@YuvanVighnesh

BE GONE NON OLYMPIAN WORSHIPPER

GO ROT IN TARTARUS

Profile icon
YuvanVighnesh
Profile icon
FlaminHotValdez
Profile icon
YuvanVighnesh
Profile icon
FlaminHotValdez

@YuvanVighnesh

You gotta think outside the box bro

I present to you...

The ultimate negator card....

Screenshot from 2021-03-14 17-50-44

UNO SKIP!

Profile icon
YuvanVighnesh
Profile icon
potatojs

@FlaminHotValdez lol well yes and no