~ubuntu-branches/ubuntu/saucy/ruby-facets/saucy

« back to all changes in this revision

Viewing changes to src/core/facets/numeric/approx.rb

  • Committer: Package Import Robot
  • Author(s): Marc Dequènes (Duck)
  • Date: 2013-06-21 14:41:38 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130621144138-nb3t82yl5gl8p7a6
Tags: 2.9.3-1
* New upstream release:
  - rakefile is gone, switched back to setuprb method
  - recreated documention build rules and adapted to new paths
* Updated copyright file.
* Increased Standards-Version to 3.9.4 (no changes).
* Removed transitional libfacets-* package and obsolete relations.
* Use system JQuery library instead of embedded one for documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
class Numeric
2
 
 
3
 
  # Determines if another number is approximately equal
4
 
  # within a given _n_th degree. Defaults to 100ths
5
 
  # if the degree is not specified.
6
 
  #
7
 
  # CREDIT: Trans
8
 
 
9
 
  def approx?(x, n=0.01)
10
 
    return(self == x) if n == 0
11
 
    (self - x).abs <= n
12
 
  end
13
 
 
14
 
end
15