Methods
Public Instance methods
approx?( x, n=0.01 )

Determines if another number is approximately equal within a given _n_th degree. Defaults to 100ths if the degree is not specified.

# File lib/facets/core/numeric/approx.rb, line 6
  def approx?( x, n=0.01 )
    return(self == x) if n == 0
    (self - x).abs <= n
  end
ceil_multiple(multiple)

Returns the multiple ceil of a number.

# File lib/facets/core/numeric/ceil_multiple.rb, line 8
  def ceil_multiple(multiple)
    # gmosx: to_f is needed!
    # gmosx: IS THERE a more optimized way to do this?
    return ((self.to_f/multiple).ceil*multiple)
  end
distance( other )

Returns the distance between self an another value. This is the same as #- but it provides an alternative for common naming between variant classes.

  4.distance(3)  #=> 1
# File lib/facets/core/numeric/distance.rb, line 10
  def distance( other )
    self - other
  end
pred(n=nil)

Provides pred as the opposite of succ.

  3.pred(2)  #=> 1
# File lib/facets/core/numeric/succ.rb, line 17
  def pred(n=nil)
    n ||= 1
    self - n
  end
round_at(*args)

To properly support Float’s rounding methods, Numeric must also be augmented.

# File lib/facets/core/float/round_at.rb, line 21
  def round_at(*args)
    self.to_f.round_at(*args)
  end
round_to(*args)

To properly support Float’s rounding methods, Numeric must also be augmented.

# File lib/facets/core/float/round_to.rb, line 22
  def round_to(*args)
    self.to_f.round_to(*args)
  end
succ(n=nil)

Allows succ to take n increments.

  3.succ(2)  #=> 5
# File lib/facets/core/numeric/succ.rb, line 8
  def succ(n=nil)
    n ||= 1
    self + n
  end
to_b()

Provides a boolean interpretation of self. If self == 0 then false else true.

  0.to_b    #=> false
  1.to_b    #=> true
  2.3.to_b  #=> true
# File lib/facets/core/numeric/to_b.rb, line 11
  def to_b
    self == 0 ? false : true
  end