JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 62
  • Score
    100M100P100Q67424F
  • License MIT

Quadratic Equation Solver

Package Exports

  • quadratic-solver

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (quadratic-solver) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Quadratic Equation Solver

npm Drone Status Travis Status Codecov Dependencies

This NodeJS module brings the ability of finding roots of a quadratic equation by simply requiring it :)

Example Usage

Browser Import

<script src="https://unpkg.com/quadratic-solver@latest/dist/quadratic-solver.js"></script>
<script>
    console.log(qs.GetVersion());
    const rootsArr = qs.QuadSolver(2, 5, -3);
    rootsArr.map(root => console.log(`Root: ${root}`));
</script>

NodeJS Module

const { QuadSolver, GetVersion } = require("quadratic-solver");
console.log(GetVersion());
const rootsArr = QuadSolver(2, 5, -3);
rootsArr.map(root => console.log(`Root: ${root}`));

Methods

QuadSolver(a, b, c)

Arguments

  • a: coefficent of the squared term
  • b: coefficient of the linear term
  • c: constant with its sign

Return Value

  • when both roots are real: Array[2] with the roots of the equation
  • when only one root is real: Array[2] wherein the first element is the real root and the other element is a warning
  • when both roots are imaginary: Array[2] in which both elements are warnings

CompleteSquare(a, b, c)

Arguments

  • a: coefficent of the squared term
  • b: coefficient of the linear term
  • c: constant with its sign

Return Value

  • when both roots are real: Array[2] with the solutions for the equation
  • when both roots are imaginary: Array[2] with both elements are in which both elements are NaN

QuadSolverCitardauq(a, b, c)

Arguments

Same as QuadSolver(a, b, c)

Return Value

Same as QuadSolver(a, b, c)

GetVersion()

Arguments

No arguments are required

Return Value

String containing name and version of the package in quadratic-solver v0.0.x format.

ES6 Classes

Solver(a, b, c)

  • a: coefficent of the squared term; default: 2
  • b: coefficient of the linear term; default: 5
  • c: constant with its sign; default: -3

Methods

versionMethod()

Returns the package version.

Author

Sudipto Ghosh

License

Source code distributed under the MIT License