mathematical-constant
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

mathematical-constant

Downloads PayPal

Computed constants decimals

e => Napier's constant, or Euler's number
γ => Euler–Mascheroni constant
π => pi
√2 => Pythagoras' constant
√3 => Theodorus' constant
√5 => Square root of 5
Φ  => Golden ratio 

☁️ Installation

# Using npm
npm install --save mathematical-constant

# Using yarn
yarn add mathematical-constant

📋 Example

const {
  EULER_MASCHERONI_CONSTANT,
  GOLDEN_RATIO_CONSTANT,
  EULER_NUMBER,
  PI,
  PYTHAGORAS_CONSTANT,
  SQUARE_ROOT_5,
  THEODORUS_CONSTANT,
} = require("mathematical-constant");

// => "0.577215664901532", "577215664901532"
console.log(EULER_MASCHERONI_CONSTANT(15), EULER_MASCHERONI_CONSTANT(15, false) );

// => "1.618033988749894", "618033988749894"
console.log(GOLDEN_RATIO_CONSTANT(15), GOLDEN_RATIO_CONSTANT(15, false));

// => "2.718281828459045", "718281828459045"
console.log(EULER_NUMBER(15), EULER_NUMBER(15, false));

// => "3.141592653589793", "141592653589793"
console.log(PI(15), PI(15, false));

// => "1.414213562373095", "414213562373095"
console.log(PYTHAGORAS_CONSTANT(15), PYTHAGORAS_CONSTANT(15, false));

// => "2.236067977499789", "236067977499789"
console.log(SQUARE_ROOT_5(15), SQUARE_ROOT_5(15, false));

// => "1.732050807568877", "732050807568877"
console.log(THEODORUS_CONSTANT(15), THEODORUS_CONSTANT(15, false));

Package Sidebar

Install

npm i mathematical-constant

Weekly Downloads

10

Version

1.0.6

License

MIT

Unpacked Size

6.11 MB

Total Files

17

Last publish

Collaborators

  • aguiaru11