Class: Flt::SigDecimalsTolerance
- Inherits:
-
FloatingTolerance
- Object
- Tolerance
- FloatingTolerance
- Flt::SigDecimalsTolerance
- Defined in:
- lib/flt/tolerance.rb
Overview
Implementation of (floating) tolerances given in number of significant decimal digits
Instance Method Summary collapse
-
#initialize(ndec, rounded = true) ⇒ SigDecimalsTolerance
constructor
A new instance of SigDecimalsTolerance.
- #to_s ⇒ Object
Methods inherited from FloatingTolerance
float_minimum_normalized_fraction, ref_adjusted_exp, #relative_to_many
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, #relative_to_many, #seq?, #value, #zero?
Constructor Details
#initialize(ndec, rounded = true) ⇒ SigDecimalsTolerance
Returns a new instance of SigDecimalsTolerance.
444 445 446 447 448 |
# File 'lib/flt/tolerance.rb', line 444 def initialize(ndec, rounded = true) super Tolerance.decimals(ndec, rounded), 10 @decimals = ndec @rounded = rounded end |
Instance Method Details
#to_s ⇒ Object
449 450 451 |
# File 'lib/flt/tolerance.rb', line 449 def to_s "#{@decimals} sig. #{@rounded ? 'r.' : 'r'}dec." end |