Created
July 17, 2020 02:22
-
-
Save acfatah/e60afa48d1000e2c7dcffbb5d49bbe4d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Checks whether two numbers are approximately equal to each other, with a small difference | |
* @param {number} alpha | |
* @param {number} beta | |
* @param {number} [epsilon=0.001] | |
* @returns {boolean} | |
*/ | |
export default (alpha, beta, epsilon = 0.001) => Math.abs(alpha - beta) < epsilon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment