In Files

Methods

Class Index [+]

Quicksearch

Flt::Num::Overflow

Overflow Exception.

This occurs and signals overflow if the adjusted exponent of a result (from a conversion or from an operation that is not an attempt to divide by zero), after rounding, would be greater than the largest value that can be handled by the implementation (the value Emax).

The result depends on the rounding mode:

For round-half-up and round-half-even (and for round-half-down and round-up, if implemented), the result of the operation is +/-Infinity, where the sign is that of the intermediate result. For round-down, the result is the largest finite number that can be represented in the current precision, with the sign of the intermediate result. For round-ceiling, the result is the same as for round-down if the sign of the intermediate result is 1, or is +Infinity otherwise. For round-floor, the result is the same as for round-down if the sign of the intermediate result is 0, or is -Infinity otherwise. In all cases, Inexact and Rounded will also be raised.

Public Class Methods

handle(context, sign, *args) click to toggle source
     # File lib/flt/num.rb, line 270
270:     def self.handle(context, sign, *args)
271:       if [:half_up, :half_even, :half_down, :up].include?(context.rounding)
272:         context.num_class.infinity(sign)
273:       elsif sign==1
274:         if context.rounding == :ceiling
275:           context.num_class.infinity(sign)
276:         else
277:           context.num_class.new([sign, context.num_class.int_radix_power(context.precision) - 1, context.emax - context.precision + 1])
278:         end
279:       elsif sign==1
280:         if context.rounding == :floor
281:           context.num_class.infinity(sign)
282:         else
283:           context.num_class.new([sign, context.num_class.int_radix_power(context.precision) - 1, context.emax - context.precision + 1])
284:         end
285:       end
286:     end
new(context=nil, sign=nil, *args) click to toggle source
     # File lib/flt/num.rb, line 287
287:     def initialize(context=nil, sign=nil, *args)
288:       @sign = sign
289:       super context
290:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.