JSPM

array-almost-equal

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 403
  • Score
    100M100P100Q99283F
  • License MIT

whether two number arrays are almost equal

Package Exports

  • array-almost-equal

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (array-almost-equal) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

array-almost-equal

stable

Tests whether two arrays are almost equal; that is, any numbers are within a certain epsilon.

var almostEqual = require('array-almost-equal')

//defaults to float epsilon
almostEqual(['foo', 1, 1], ['foo', 1, 1 + 1e-12]) // true
almostEqual(['bar', 2], ['foo', 2]) // false

//custom epsilon
almostEqual(['foo', 1, 0.0025], ['foo', 1, 0.0026], 0.01) // true

Usage

NPM

almostEqual(a, b[, epsilon[, relativeTolerance]])

Tests whether a and b are arrays (or typed arrays), equal length, and all elements are strictly equal or numbers are almost equal.

epsilon defaults to FLT_EPSILON. relativeTolerance defaults to epsilon if not specified.

License

MIT, see LICENSE.md for details.