1.0.0 • Published 6 years ago

@typeforce/pi v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

pi

NPM NPM CDN LICENSE

The closest approximation to the numeric constant 'pi', the ratio of a circle's circumference to its diameter.

Usage

    npm install @typeforce/pi --save   # Install package via NPM
    import { expect } from "chai";
    import pi from "@typeforce/pi";

    // The constant can be accessed directly:
    expect(pi.pi).to.be.approximately(Math.PI, 1e-8);

    // Or it can be calculated:
    expect(pi.calculate()).to.be.approximately(Math.PI, 1e-8);

This package contains TypeScript type declarations.

Content Delivery Network (CDN)

This package can be imported via unpkg as demonstrated below.

    <script src="https://unpkg.com/@typeforce/pi/dist/index.min.js">
    <script type="application/javascript">
        var x = Math.PI;
        if (x === pi) {
            // Yay!
        }
    </script>

Build & Test

This package uses Gulp for building, and Chai and Mocha for testing.

    npm install     # Installs dependencies.
    npm run build   # Build the project.
    npm test        # Run tests.

License

Refer to the LICENSE file for license information.