Pi Day: Functions For Including Pi In Your Code

March 14 is often said to be Pi day, since the value of Π is 3.14 (if you express it to just two decimal places). While no rational Australian writes the date in the format 3/14, celebrate anyway with this reminder of the functions for accessing an approximate value of Π in different languages.

Pi picture from Shutterstock

Rosetta Code lists built-in mathematical functions across 83 languages, though not all those languages include Π as a built-in function. Math.Pi, anyone?

Real constants and functions [Rosetta Code]

The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.


6 responses to “Pi Day: Functions For Including Pi In Your Code”