MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / hasRoot

Function hasRoot

Maths/BisectionMethod.js:25–27  ·  view source on GitHub ↗
(a, b, func)

Source from the content-addressed store, hash-verified

23
24 // Bolzano theorem
25 const hasRoot = (a, b, func) => {
26 return func(a) * func(b) <= 0
27 }
28 if (hasRoot(a, b, func) === false) {
29 throw Error(
30 'Product f(a)*f(b) has to be negative so that Bolzano theorem is applied'

Callers 1

findRootFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected