JSPM

quadratic-equations-solver

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

Solve quadratic equations with response values.

Package Exports

  • quadratic-equations-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-equations-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-equations-solver

NPM module to solve quadratic equations.

Install

npm i quadratic-equations-solver

Use

The equation has to be under the ax²+bx+c=0 form. Example:

const solve = require("quadratic-equations-solver");

var a = '1';
var b = '-12';
var c = '-28';
var solutions = solve(a, b, c);
var solution1 = solutions[0];  // Give you the first solution possible
var solution2 = solutions[1];  // Give you the second solution possible
var discriminant = solutions[2];  // Give you the discriminant (b²-4ac)

NOTE: If the discriminant is equal to zero, only one solution will possible, which means solution1 and solution2 will have the same value.