Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 875 Bytes

README.md

File metadata and controls

42 lines (26 loc) · 875 Bytes

citardauq-roots

NPM

Numerically stable method for solving quadratic equations
Note: 'citardauq' is 'quadratic', reversed

Install

$ npm install --save citardauq-roots

Usage

const quadraticRoots = require('citardauq-roots')

console.log(quadraticRoots(1, 0, -1))
// => [1, -1]

console.log(quadraticRoots(1, -5, 6))
// => [3, 2]

console.log(quadraticRoots(1, -2, 1))
// => [1]

console.log(quadraticRoots(-4, 1, 3))
// => [-0.75, 1]

console.log(quadraticRoots(0, 2, 3))
// => Error: a can not be 0

console.log(quadraticRoots(1, 0, 1))
// => Error: No real roots

License

MIT © Nicolás Quiroz