Sha256: ec9ccb340f7832fa363b17b714d92ea3dd9243e50c7cd8b052189d53e2f0af5d

Contents?: true

Size: 148 Bytes

Versions: 25

Compression:

Stored size: 148 Bytes

Contents

class Float
  EPISILON = 1e-6

  # Equals for floats with tolerance
  def equals?(x, tolerance = EPISOLON)
    (self - x).abs < tolerance
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
darkhelmet-darkext-0.9.3 lib/darkext/float.rb
darkhelmet-darkext-0.9.4 lib/darkext/float.rb
darkhelmet-darkext-0.9.5 lib/darkext/float.rb
darkhelmet-darkext-0.9.6 lib/darkext/float.rb
darkhelmet-darkext-0.9.7 lib/darkext/float.rb