1.6.0 • Published 27 days ago

generate-pi v1.6.0

Weekly downloads
4
License
MIT
Repository
github
Last release
27 days ago

generate-pi

Find PI(π) to the Nth Digit

CI npm version npm downloads

generate-pi provides a simple utility to find the value of Pi (π) up to the Nth decimal place. It offers both a default function to retrieve Pi with high precision and the flexibility to specify the number of decimal places required. The library uses the Bailey–Borwein–Plouffe formula to calculate Pi to the desired precision. It is lightweight and easy to use, making it a great choice for projects that require high-precision calculations of Pi.

Installation

Via Npm:

npm install generate-pi

Usage

import generatePi from 'generate-pi';

// Find PI(π) to the 'n' decimal places
// where n is any number between 0 and 200
const pi = generatePi.get(n);

// Find PI(π) to the 10 decimal places
const pi10 = generatePi.get(10);
// "3.1415926535"

// Default to 200 decimal places
const pi200 = generatePi.get();

API

generatePi.get(n)

Returns the value of PI(π) to the 'n' decimal places.

n

Type: number Default: 200

The number of decimal places to return. It should be a number between 0 and 200.

Run Tests

npm run test

License

MIT © Palash Mondal

1.6.0

27 days ago

1.5.14

5 years ago

1.5.13

5 years ago

1.5.12

6 years ago

1.5.11

6 years ago

1.5.10

6 years ago

1.5.9

6 years ago

1.5.8

6 years ago

1.5.7

6 years ago

1.5.6

6 years ago

1.5.5

6 years ago

1.5.4

6 years ago

1.5.3

6 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago