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.10.0 lib/darkext/float.rb
darkhelmet-darkext-0.5.3 lib/darkext/float.rb
darkhelmet-darkext-0.5.4 lib/darkext/float.rb
darkhelmet-darkext-0.5.5 lib/darkext/float.rb
darkhelmet-darkext-0.5.6 lib/darkext/float.rb
darkhelmet-darkext-0.6.0 lib/darkext/float.rb
darkhelmet-darkext-0.7.0 lib/darkext/float.rb
darkhelmet-darkext-0.7.1 lib/darkext/float.rb
darkhelmet-darkext-0.7.2 lib/darkext/float.rb
darkhelmet-darkext-0.7.3 lib/darkext/float.rb
darkhelmet-darkext-0.8.0 lib/darkext/float.rb
darkhelmet-darkext-0.8.1 lib/darkext/float.rb
darkhelmet-darkext-0.8.2 lib/darkext/float.rb
darkhelmet-darkext-0.8.3 lib/darkext/float.rb
darkhelmet-darkext-0.8.4 lib/darkext/float.rb
darkhelmet-darkext-0.8.5 lib/darkext/float.rb
darkhelmet-darkext-0.8.6 lib/darkext/float.rb
darkhelmet-darkext-0.8.7 lib/darkext/float.rb
darkhelmet-darkext-0.9.0 lib/darkext/float.rb
darkhelmet-darkext-0.9.2 lib/darkext/float.rb