Pi (constant)

Syntax

Pi

Description

The Double value 3.141592653589793238462643383279.

Comments

Pi can also be determined using the following formula:

 4 * Atn(1)

Example

This example illustrates the use of the Pi constant.

Const crlf = Chr$(13) + Chr$(10)

Sub Main()
  dia = InputBox("Enter a circle diameter to compute.","Compute Circle")
  circ# = Pi * dia
  area# = Pi * ((dia / 2) ^ 2)
  msg1 = "Diameter: " & dia & crlf
  msg1 = msg1 & "Circumference: " & Format(circ#,"Standard") & crlf
  msg1 = msg1 & "Area: " & Format(area#,"Standard")
  MsgBox msg1
End Sub

See Also

Tan (function); Atn (function); Cos (function); Sin (function).

More information

P