Sha256: b3ff41fbcaa3af76f432f555c2db39fa64b57bf1d9dc0385143f66787b1b1e2d

Contents?: true

Size: 276 Bytes

Versions: 7

Compression:

Stored size: 276 Bytes

Contents

class Numeric

  # Determines if another number is approximately equal
  # within a given _n_th degree. Defaults to 100ths
  # if the degree is not specified.
  #
  #  CREDIT: Trans

  def approx?(x, n=0.01)
    return(self == x) if n == 0
    (self - x).abs <= n
  end

end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
facets-2.4.0 lib/facets/numeric/approx.rb
facets-2.4.1 lib/facets/numeric/approx.rb
facets-2.4.2 lib/core/facets/numeric/approx.rb
facets-2.4.3 lib/core/facets/numeric/approx.rb
facets-2.4.4 lib/core/facets/numeric/approx.rb
facets-2.4.5 lib/core/facets/numeric/approx.rb
mack-facets-0.8.2 lib/gems/facets-2.4.5/lib/core/facets/numeric/approx.rb