Pi: Most widely known mathematical constant

Pi is the most widely known mathematical constant that is commonly defined as the ratio of a circle’s circumference to its diameter approximately equal to 3.14159. It is also represented by the Greek letter “π”.
I am writing here about the Pi because It always attract me and in my programming life there are many situation when I need to use the pi value in programming such as to calculate the area of the circle. Pi is an irrational number, meaning its digits go on forever in a seemingly random sequence. Commonly we use the 22/7 to calculate the value of Pi that gives the never ended decimal represented without any repeating pattern.

Approximate value

Fractions: Approximate fractions include (in order of increasing accuracy) 22/7, 333/106, 355/113, 52163/16604, 103993/33102, and 245850922/78256779

Decimal: The first 100 decimal digits are 3.14159 26535 89793 23846 26433 83279 50288 41971 69399 37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 70679 ….

Binary: 11.001001000011111101101010100010001000010110100011 ….

Hexadecimal: The base 16 approximation to 20 digits is 3.243F6A8885A308D31319 …

Use Pi in C#

In C#, Math.Pi field Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π. And the value of this field is 3.14159265358979323846.

The following example uses PI to calculate the area of the circle.

class UseOfPi
{
    static void Main(string[] args)
    {
        UseOfPi objClass = new UseOfPi();
        double radius = 7.8;
        double AreaOfCircle = objClass.GetArea(radius);
    }
    public double GetArea(double radius)
    {
        double area = Math.PI * radius * radius;
        return area;
    }
}

Use Pi in JavaScript

We can use math.pi to get the constant value of PI. Value of the PI is approximately 3.14159. You can use math.pi in JavaScript like this:

<html>
  <head>
    <title> Value of PI </title>
  </head>
   <body>
     <script language="JavaScript">
           var result = Math.PI;
          document.write( "The Approximate value of PI is: " + result );
      </script>  
   </body>
</html>

See another example: How to calculate area of circle in JavaScript

Character Encoding

Character

Unicode name

n-ary product

n-ary coproduct

mathematical bold
capital pi

mathematical bold
small pi

mathematical italic
capital pi

mathematical italic
small pi

Encodings

decimal

hex

decimal

hex

decimal

hex

decimal

hex

decimal

hex

decimal

hex

Unicode

8719

U+220F

8720

U+2210

120503

U+1D6B7

120529

U+1D6D1

120561

U+1D6F1

120587

U+1D70B

UTF-8

226 136 143

E2 88 8F

226 136 144

E2 88 90

240 157 154 183

F0 9D 9A B7

240 157 155 145

F0 9D 9B 91

240 157 155 177

F0 9D 9B B1

240 157 156 139

F0 9D 9C 8B

UTF-16

8719

220F

8720

2210

55349 57015

D835 DEB7

55349 57041

D835 DED1

55349 57073

D835 DEF1

55349 57099

D835 DF0B