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]


Comments

    Isn't Pi Day the 22nd of July...22/7?

      22/7 != Pi

        It does to 2 decimal places, which was the opening premise in the article anyway, so I think Philbyfish gets a pass on that.

    considering the date is the 14/3/2014 , its not PI (3.14159265359...) day

      No, that makes it 0.00231711 day. Accurate but not as catchy.

    "While no rational Australian writes the date in the format 3/14". Please make my day and tell me that pun was intentional.

    Silly Americans and their weird date formats :p

    I'll wait to celebrate Pi on the 3rd day of the 14th month tyvm... Oh wait... Maybe I'll just go buy a pie from the bakery as an excuse to celebrate Pi :p

    Last edited 15/03/14 8:23 am

    While no rational Australian writes the date in the format 3/14

    I see what you did there..

Join the discussion!

Trending Stories Right Now