Parent

Class Index [+]

Quicksearch

Float

Float constants.

Note that this uses the “fractional significand” interpretation, i.e. the significand has the radix point before its first digit.

Float::RADIX : b = Radix of exponent representation,2

Float::MANT_DIG : p = bits (base-RADIX digits) in the significand

Float::DIG : q = Number of decimal digits such that any floating-point number with q

             decimal digits can be rounded into a floating-point number with p radix b
             digits and back again without change to the q decimal digits,
                q = p * log10(b)                      if b is a power of 10
                      q = floor((p - 1) * log10(b))  otherwise
             ((Float::MANT_DIG-1)*Math.log(FLoat::RADIX)/Math.log(10)).floor

Float::MIN_EXP : emin = Minimum int x such that Float::RADIX**(x-1) is a normalized float

Float::MIN_10_EXP : Minimum negative integer such that 10 raised to that power is in the

                   range of normalized floating-point numbers,
                     ceil(log10(b) * (emin - 1))

Float::MAX_EXP : emax = Maximum int x such that Float::RADIX**(x-1) is a representable float

Float::MAX_10_EXP : Maximum integer such that 10 raised to that power is in the range of

                    representable finite floating-point numbers,
                      floor(log10((1 - b**-p) * b**emax))

Float::MAX : Maximum representable finite floating-point number

               (1 - b**-p) * b**emax

Float::EPSILON : The difference between 1 and the least value greater than 1 that is

                 representable in the given floating point type
                   b**(1-p)
                 Math.ldexp(*Math.frexp(1).collect{|e| e.kind_of?(Integer) ? e-(Float::MANT_DIG-1) : e})

Float::MIN : Minimum normalized positive floating-point number

                 b**(emin - 1).
              In JRuby this is the mininimum denormal number!

Float::ROUNDS : Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown.

Note: Ruby 1.9.2 Adds Float::INFINITY and Float::NAN

Additional contants defined here:

Float::DECIMAL_DIG : Number of decimal digits, n, such that any floating-point number can be rounded

                      to a floating-point number with n decimal digits and back again without
                      change to the value,
                        pmax * log10(b)                       if b is a power of 10
                        ceil(1 + pmax * log10(b))     otherwise
                      DECIMAL_DIG = (MANT_DIG*Math.log(RADIX)/Math.log(10)).ceil+1

Float::MIN_N : Minimum normalized number == MAX_D.next == MIN (not in JRuby)

Float::MAX_D : Maximum denormal number == MIN_N.prev

Float::MIN_D : Minimum non zero positive denormal number == 0.0.next (== MIN in JRuby)

Float::MAX_F : Maximum significand

Constants

DECIMAL_DIG
MIN_N

Minimum normalized number == MAX_D.next

MAX_D

Maximum denormal number == MIN_N.prev

MIN_D

Minimum non zero positive denormal number == 0.0.next

MAX_F

Maximum significand == Math.ldexp(Math.ldexp(1,Float::MANT_DIG)-1,-Float::MANT_DIG)

Public Class Methods

Num(*args) click to toggle source
    # File lib/flt/sugar.rb, line 40
40:   def self.Num(*args)
41:     context.Num(*args)
42:   end
context() click to toggle source

Return a (limited) context object for Float. This eases the implementation of functions compatible with either Num or Float values.

     # File lib/flt/float.rb, line 483
483: def Float.context
484:   Flt::FloatContext.instance
485: end
radix() click to toggle source
    # File lib/flt/sugar.rb, line 36
36:   def self.radix
37:     context.radix
38:   end

Public Instance Methods

next_toward(other) click to toggle source
    # File lib/flt/sugar.rb, line 66
66:   def next_toward(other)
67:     Float.context.next_toward(self, other)
68:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.