pi

Going deeper inside of the PI number.

PI Number

Going deeper inside of the PI number. Get the first n decimals of the PI number.

Run the following commands to download and install the application:

$ npm install -g pi

Usage:

$ pi 16
3.141592653589793
// Dependencies 
var PI = require("pi");
 
// Three decimals 
console.log(PI(3));
 
// 16 decimals 
console.log("First 16 decimals: " + PI(16, false));

Output:

3.14
First 16 decimals: 141592653589793

Calculates the first n decimals of PI number.

  • Number digits: The number of decimals of the PI number.
  • Boolean includeThree: A flag indicating if the "3." snippet should be prepended or not (default: true).
  • String The PI decimals.

This algorithm is highly based on this great answer from StackOverflow. Thanks! :smile:

  1. File an issue in the repository, using the bug tracker, describing the contribution you'd like to make. This will help us to get you started on the right foot.
  2. Fork the project in your account and create a new branch: your-great-feature.
  3. Commit your changes in that branch.
  4. Open a pull request, and reference the initial issue in the pull request message.

See the LICENSE file.