Class: Flt::RelativeTolerance

Inherits:
Tolerance show all
Defined in:
lib/flt/tolerance.rb

Overview

Implementation of relative tolerances

Instance Method Summary collapse

Methods inherited from Tolerance

#[], big_epsilon, bits, #cast_value, decimals, define_sugar, #descr_value, digits, epsilon, #eq?, #equal_to?, #greater_than?, #gt?, #integer, #integer?, #less_than?, #lt?, #relative_to_many, #seq?, #value, #zero?

Constructor Details

#initialize(value) ⇒ RelativeTolerance

Returns a new instance of RelativeTolerance.



277
278
279
# File 'lib/flt/tolerance.rb', line 277

def initialize(value)
  super
end

Instance Method Details

#relative_to(x) ⇒ Object



280
281
282
# File 'lib/flt/tolerance.rb', line 280

def relative_to(x)
  x.abs*cast_value(x.class)
end

#to_sObject



283
284
285
# File 'lib/flt/tolerance.rb', line 283

def to_s
  "#{descr_value}/1"
end