package
Stringify number values that might be multiples of π
npm install stringify-piGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Stringify number values that might be multiples of π.
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'Required
Type: number
A number that might be a (fractional) multiple of π.
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.
MIT © James Talmage
Estimated unpacked size across 3 packages.
6.3 kB
Includes dependencies.
github:jamestalmage/num2fraction#1ff5e5a
1.3.0