Class: Float

Inherits:
Object
  • Object
show all
Defined in:
lib/float/equalindelta.rb

Overview

! /usr/bin/env ruby coding: utf-8

Instance Method Summary collapse

Instance Method Details

#equal_in_delta?(other, delta) ⇒ Boolean

return true if absolute value of the difference between self and other is smaller than delta.

Returns:

  • (Boolean)


7
8
9
# File 'lib/float/equalindelta.rb', line 7

def equal_in_delta?(other, delta)
  (self - other).abs < delta
end