Last Thursday was Pi day, at least in those parts of the world with a month-before-day date format. Google celebrated this event by computing a record-breaking 31.4 trillion digits of Pi. There's no practical applications for this whatsoever, but it did get me wondering: how much Pi is enough?

Let's figure this out by using some practical examples.

The following function can be used to compute a circle's circumference when given it's diameter and the value of Pi:

```
def circumference(diameter, pi):
return diameter * pi
```

Yes, I know it's very complicated.

Let's use it to compute the circumference of Earth. For this, we'll need to know the Earth's diameter. The Earth is not a perfect sphere so the diameter varies from place to place, but for the sake of simplicity let's just use the mean diameter of 12742 km.

By using 3,1415 for Pi (so only 4 decimals—trivial to memorize) we get a circumference of 40028,993 kilometer, which is only off by roughly one kilometer. Not bad, but we can do better. The calculator app on my phone has a Pi constant built in, which contains 10 decimals. Using that reduces the error to about a single millimeter.

Think about that. Using the phone in your pocket, you can compute the Earth's circumference to within millimeter accuracy.

But what about something bigger? Let's say, the entire observable universe?

The observable universe has an estimated diameter of roughly 93 billion light-years. Computing its circumference using "only" 10 decimals of Pi gets us an answer that's accurate to within a few thousand kilometers. That might seem like a lot, but remember that we're computing the circumference of literally the *entire observable universe*, and we're measuring our margin of error in *kilometers*. That's crazy.

To answer the question, "how much Pi is enough", the answer is: less than 31 trillion. The easy-to-remember value of 3,1415 is actually surprisingly accurate. If you're working with really large distances or you just want to be extra sure of something, whatever's in your phone's calculator will be more than enough for any practical uses you'll ever run into (and, to be fair, how often does that really happen in one lifetime?). Beyond that you're likely working for NASA, and even they only use about 15 decimals at the most.

So yeah, happy Pi day, I guess. And congrats on your Guinness World Record, Google!