FUNCTIONS CORE

Pi()

Return the mathematical constant pi

Syntax

Signature
Pi( ) --> nPi

Example

Pi.prg
PROCEDURE Main()

   LOCAL nRadius := 2

   Check( 'Round( Pi(), 6 )               ', Round( Pi(), 6 ), 3.141593 )
   Check( 'Round( Pi() * nRadius ^ 2, 6 ) ', Round( Pi() * nRadius ^ 2, 6 ), 12.566371 )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

Round( Pi(), 6 )               OK
Round( Pi() * nRadius ^ 2, 6 ) OK