https://github.com/binjospookie/math-interval-functions
A tiny (119 bytes) and blazing fast solution for operations on intervals.
https://github.com/binjospookie/math-interval-functions
Last synced: about 2 months ago
JSON representation
A tiny (119 bytes) and blazing fast solution for operations on intervals.
- Host: GitHub
- URL: https://github.com/binjospookie/math-interval-functions
- Owner: binjospookie
- License: mit
- Created: 2020-04-15T14:34:07.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T04:42:08.000Z (about 3 years ago)
- Last Synced: 2025-11-24T04:17:29.281Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.13 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-blazingly-fast - math-interval-functions - A tiny (119 bytes) and blazing fast solution for operations on intervals. (TypeScript)
README
# math-interval-functions



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
```javascript
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
```