1.0.0 • Published 11 years ago
pi-1 v1.0.0

PI Number
Going deeper inside of the PI number. Get the first n decimals of the PI number.
Installation
Run the following commands to download and install the application:
$ npm install -g pi-numberUsage:
$ pi 16
3.141592653589793Example
// 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: 141592653589793Documentation
PI(digits, includeThree)
Calculates the first n decimals of PI number.
Params
- 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).
Return
- String The PI decimals.
Credits
This algorithm is highly based on this great answer from StackOverflow. Thanks! :smile:
How to contribute
- 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.
License
See the LICENSE file.
1.0.0
11 years ago