Skip to content

Simple floating point binary search for JavaScript

License

Notifications You must be signed in to change notification settings

eiriklv/bisect

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bisect

Floating point bisection method for JavaScript

Usage

Install using npm:

npm install bisect

And use as follows:

var bisect = require("bisect")

//Find cube root of 5 to 8 decimal places
console.log(bisect(
  function(x) {
    return x * x * x - 5 > 0
  },
  -10, 10, 1e-8))

require("bisect")(predicate, lo, hi[, tolerance])

Supposing that predicate is monotone over the interval [lo,hi), finds the first occurence of where predicate is true up to a resolution of tolerance.

Credits

(c) 2013 Mikola Lysenko. MIT License

About

Simple floating point binary search for JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%