Class: Flt::PercentTolerance

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

Overview

Implementation of percent (relative) tolerances

Instance Method Summary collapse

Methods inherited from RelativeTolerance

#relative_to

Methods inherited from Tolerance

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

Constructor Details

#initialize(value) ⇒ PercentTolerance

Returns a new instance of PercentTolerance


290
291
292
# File 'lib/flt/tolerance.rb', line 290

def initialize(value)
  super
end

Instance Method Details

#cast_value(num_class) ⇒ Object


296
297
298
# File 'lib/flt/tolerance.rb', line 296

def cast_value(num_class)
  num_class.Num(@value)/num_class.Num(100)
end

#to_sObject


293
294
295
# File 'lib/flt/tolerance.rb', line 293

def to_s
  "#{descr_value}%"
end