Function Math Arithmetic Class

GeneratePi

One (slow) method for generating Pi. We strongly suggest that you use the Pi property instead of calling this function.

Signature (Visual Basic / VBA)

Public Function GeneratePi( _
    Optional ByVal vIterations As Variant _
    ) As Variant

Code Example

    GeneratePi() = 3.14006054332738
    GeneratePi(1024000) = 3.14159111961092
    Pi = 3.14159265358979

Parameters

Parameter Description
vIterations The number of iterations through the loop which approximates the value of Pi. vIterations defaults to 1,024 if it is missing or Null or cannot be fixed up to a number.