_PI

From QB64 Wiki
Revision as of 12:46, 10 September 2017 by imported>SMcNeill (-)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The _PI function returns π as a _FLOAT value with an optional multiplier parameter.


Syntax

circumference = _PI[(multiplier)]


Parameters

  • Optional multiplier (2 * radius in above syntax) allows multiplication of the π value.


Description

  • Function can be used in to supply π or multiples in a program.
  • Accuracy is determined by the return variable type AS SINGLE, DOUBLE or _FLOAT.
  • The π value can also be derived using 4 * ATN(1) for a SINGLE value.


Examples

Example: Calculating the area of a circle using a SINGLE variable in this case.

radius = 5 circlearea = _PI(radius ^ 2) PRINT circlearea

78.53982


See also



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page