Class: Numeric

Inherits:
Object show all
Defined in:
lib/helper/numeric.rb

Instance Method Summary collapse

Instance Method Details

#approx_sort(other, tol = self.to_f/10) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/helper/numeric.rb', line 7

def approx_sort other, tol = self.to_f/10
  d = self - other
  if d > tol
    return 1
  elsif -d > tol
    return -1
  else 
    return 0
  end
end

#numeric?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/helper/numeric.rb', line 17

def numeric?
  true
end