Method pi
pi(UInt32)
Calculates π
(PI) to the desired precision and push it to the stack.
Represents the ratio of the circumference of a circle to its diameter.
Declaration
public void pi(uint c)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | c | The desired precision. |
Remarks
The desired precision is controlled by the parameter c
where c
represents a break criteria of the internal iteration.
For a desired precesission of decimal digits c
can be calculated as:
msb(pow(10, digits))
or
(uint)Math.Ceiling(digits * 3.321928094887362) // * (log(2) + log(5)) / log(2))
.
The result however has to be rounded explicitely to get an exact decimal representation.