Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/bisect
Simple floating point binary search for JavaScript
https://github.com/mikolalysenko/bisect
Last synced: about 2 months ago
JSON representation
Simple floating point binary search for JavaScript
- Host: GitHub
- URL: https://github.com/mikolalysenko/bisect
- Owner: mikolalysenko
- License: mit
- Created: 2013-03-25T19:09:37.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-04-29T01:51:35.000Z (over 10 years ago)
- Last Synced: 2024-10-20T14:27:06.592Z (2 months ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 11
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
bisect
======
Floating point bisection method for JavaScriptUsage
=====
Install using npm:npm install bisect
And use as follows:```javascript
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](http://en.wikipedia.org/wiki/Monotonic_function) 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