Module: Flt
- Defined in:
- lib/flt/complex.rb,
lib/flt/num.rb,
lib/flt/math.rb,
lib/flt/bin_num.rb,
lib/flt/dec_num.rb,
lib/flt/support.rb,
lib/flt/version.rb,
lib/flt/tolerance.rb,
lib/flt/trigonometry.rb,
lib/flt/tolerance/sugar.rb
Overview
Complex
Defined Under Namespace
Modules: BigEpsilonMixin, EpsilonMixin, MathBase, Support, Trigonometry Classes: AbsBigEpsilonTolerance, AbsEpsilonTolerance, AbsoluteTolerance, BigDecimalContext, BigEpsilonTolerance, BinNum, ComplexContext, DecNum, DecimalsTolerance, EpsilonTolerance, FloatContext, FloatingTolerance, FltBigEpsilonTolerance, FltEpsilonTolerance, Num, PercentTolerance, PermilleTolerance, RelativeTolerance, SigBitsTolerance, SigDecimalsTolerance, Tolerance, UlpsTolerance
Constant Summary collapse
- VERSION =
"1.3.3"
Class Method Summary collapse
- .BinNum(*args) ⇒ Object
- .ComplexContext(context) ⇒ Object
-
.DecNum(*args) ⇒ Object
If a DecNum is passed a reference to it is returned (no new object is created).
-
.float_correctly_rounded? ⇒ Boolean
Is Float(‘…’) correctly rounded, even for subnormal numbers?.
-
.Tolerance(*args) ⇒ Object
Tolerance constructor.
Class Method Details
.BinNum(*args) ⇒ Object
249 250 251 |
# File 'lib/flt/bin_num.rb', line 249 def BinNum(*args) BinNum.Num(*args) end |
.ComplexContext(context) ⇒ Object
294 295 296 |
# File 'lib/flt/complex.rb', line 294 def ComplexContext(context) ComplexContext.new(context) end |
.DecNum(*args) ⇒ Object
If a DecNum is passed a reference to it is returned (no new object is created).
1215 1216 1217 |
# File 'lib/flt/dec_num.rb', line 1215 def DecNum(*args) DecNum.Num(*args) end |
.float_correctly_rounded? ⇒ Boolean
Is Float(‘…’) correctly rounded, even for subnormal numbers?
488 489 490 491 |
# File 'lib/flt/float.rb', line 488 def Flt.float_correctly_rounded? # That doesn't seem to be the case for mswin32 @float_correctly_rounded ||= RUBY_PLATFORM.match(/mswin32/).nil? end |
.Tolerance(*args) ⇒ Object
Tolerance constructor.
The first parameter is the value (magnitude) of the tolerance, and is optional for some tolerances.
The next parameter is the kind of tolerance as a symbol. It corresponds to the name of the implementation class minus the Tolerance suffix, and converted to snake-case (lowercase with underscores to separate words.)
Finally any additional parameters admitted by the class constructor can be passed.
551 552 553 554 555 556 557 558 559 |
# File 'lib/flt/tolerance.rb', line 551 def Tolerance(*args) if args.first.is_a?(Symbol) value = nil else value = args.shift end cls_name = (args.shift || :absolute).to_s.gsub(/(^|_)(.)/){$2.upcase} + "Tolerance" Flt.const_get(cls_name).new(value, *args) end |