Sha256: 4123b1ef49b51ae52d772026943e29d47203df933fe2248ec97ea23da917e915

Contents?: true

Size: 237 Bytes

Versions: 7

Compression:

Stored size: 237 Bytes

Contents

module Math

  #
  EPSILON = 0.000000001

  # Approximately equal.
  #
  # TODO: Use core extension Numeric#approx? instead (?)
  def self.approx_equal(a, b, epsilon=EPSILON)
	  c = a - b
	  c *= -1.0 if c < 0
    c < epsilon
  end

end

Version data entries

7 entries across 6 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/standard/facets/math/approx_equal.rb
facets-3.1.0 lib/standard/facets/math/approx_equal.rb
facets-3.0.0 lib/standard/facets/math/approx_equal.rb
facets-2.9.3 lib/standard/facets/math/approx_equal.rb
facets-2.9.2 lib/standard/facets/math/approx_equal.rb
facets-2.9.2 src/standard/facets/math/approx_equal.rb
facets-2.9.1 lib/standard/facets/math/approx_equal.rb