stringify-pi

0.0.3 • Public • Published

stringify-pi

Stringify number values that might be multiples of π.

Build Status Coverage Status Code Climate Dependency Status devDependency Status

NPM

Usage

var stringifyPi = require('stringify-pi');
var π = Math.PI;
 
stringifyPi(3 / π);
//=> '3/π'
 
stringifyPi(π / 3);
//=> 'π/3'
 
stringifyPi(2 * π / 3);
//=> '2π/3'
 
stringifyPi(2 * π);
//=> '2π'
 
// works on normal fractions too
stringifyPi(2/3);
//=> '2/3'

API

stringifyPi(input)

input

Required Type: number

A number that might be a (fractional) multiple of π.

returns

A String representation of the input. If a reasonable estimation of a fractional value or fractional multiple of π can be found, the string will contain the π character.

License

MIT © James Talmage

Readme

Keywords

none

Package Sidebar

Install

npm i stringify-pi

Weekly Downloads

10

Version

0.0.3

License

MIT

Last publish

Collaborators

  • jamestalmage