is-multiple-of
Floating point modulus operator functionality for javascript.
Accurate to 16 digits and 6 decimal places.
Rationale
- javascript can't divide floats accurately: i.e. 4.55 / .05 === 90.999999
4.55 % .05 === 0
whereas:
multipleOf(4.55, .05)
Installation
$ npm install @tecfu/is-multiple-of
import multipleOf from 'https://cdn.jsdelivr.net/gh/tecfu/is-multiple-of/dist/is-multiple-of.esm.js'
let multipleOf = require('is-multiple-of')
let multipleOf = IsMultipleOf;
Version Compatibility
Node Version | multipleOf Version |
---|
8.0 | >= 1.0 |
Running tests
$ npm test
Pull Requests
Pull requests are encouraged!
- Please remember to add a unit test when necessary
- Please format your commit messages according to the "Conventional Commits" specification
If you aren't familiar with Conventional Commits, here's a good article on the topic
TL/DR:
- feat: a feature that is visible for end users.
- fix: a bugfix that is visible for end users.
- chore: a change that doesn't impact end users (e.g. chances to CI pipeline)
- docs: a change in the README or documentation
- refactor: a change in production code focused on readability, style and/or performance.
License
MIT License
Copyright 2020, Tecfu.