1.0.3 • Published 3 years ago

math-interval-functions v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

math-interval-functions

Typed with TypeScript Version CI

A tiny (119 bytes) and blazing fast solution for operations on intervals.

Installation

npm i math-interval-functions

Functions

inInterval

Check that value belongs to the interval.

Examples

inInterval({ interval: '(1,5)', value: 1 }); // false
inInterval({ interval: '[1,5)', value: 1 }); // true
inInterval({ interval: '[1,5)', value: 5 }); // false
inInterval({ interval: '[1,5]', value: 5 }); // true
inInterval({ interval: '(1,5]', value: 5 }); // true
inInterval({ interval: '(,5]', value: 5 }); // true
inInterval({ interval: '(,5]', value: 1 }); // true
inInterval({ interval: '123jkvb12h3b12h3', value: 1 }); // false
inInterval({ interval: '[-10,0]', value: -5 }); // true
inInterval({ interval: '[-10,0]', value: 1 }); // false

Addition

WIP

Subtraction

WIP

Multiplication

WIP

Division

WIP

Benchmarks

inInterval: 10,200,104 ops/sec