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-number
Usage:
$ pi 16
3.141592653589793
// Dependencies
var PI = require("pi-number");
// 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! 😄
- 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.
- Fork the project in your account and create a new branch:
your-great-feature
. - Commit your changes in that branch.
- Open a pull request, and reference the initial issue in the pull request message.
See the LICENSE file.