Skip to content

Instantly share code, notes, and snippets.

@kotp
Created March 15, 2013 21:42
Show Gist options
  • Select an option

  • Save kotp/5173308 to your computer and use it in GitHub Desktop.

Select an option

Save kotp/5173308 to your computer and use it in GitHub Desktop.

Revisions

  1. kotp created this gist Mar 15, 2013.
    5 changes: 5 additions & 0 deletions float_near_enough.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    class Float
    def near_enough?(other, epsilon = Float::EPSILON)
    (self - other.to_f).abs < epsilon.to_f
    end
    end