Class Index [+]

Quicksearch

Flt::UlpsTolerance

Implementation of (floating) tolerances given in ULPs (units in the last place)

Public Class Methods

new(n=nil, num_class=nil) click to toggle source
     # File lib/flt/tolerance.rb, line 426
426:     def initialize(n=nil, num_class=nil)
427:       @ulps = n || 1
428:       num_class ||= Float
429:       context = num_class.context
430:       unit = context.Num(1)
431:       n = context.Num(@ulps)
432:       super(context.ulp(unit)*n)
433:     end

Public Instance Methods

relative_to(x) click to toggle source
     # File lib/flt/tolerance.rb, line 437
437:     def relative_to(x)
438:       context = x.class.context
439:       n = context.Num(@ulps)
440:       context.ulp(x)*n
441:     end
relative_to_many(mode, *xs) click to toggle source
     # File lib/flt/tolerance.rb, line 442
442:     def relative_to_many(mode, *xs)
443:       xs.map{|x| relative_to(x)}.send(mode)
444:     end
to_s() click to toggle source
     # File lib/flt/tolerance.rb, line 434
434:     def to_s
435:       "#{@ulps} ulp#{(!@ulps.kind_of?(Numeric) || (@ulps > 1)) ? 's' : ''}"
436:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.