Float objects represent inexact real numbers using the native architecture’s double-precision floating point representation.
Floating point has a different arithmetic and is an inexact number. So you should know its esoteric system. see following:
-
http://wiki.github.com/rdp/ruby_tutorials_core/ruby-talk-faq#wiki-floats_imprecise
-
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
When mathn is required, Float is changed to handle Complex numbers.
BigDecimal extends the native Float class to provide the #to_d method.
When you require BigDecimal in your application, this method will be available on Float objects.
Constants
NAN = DBL2NUM(NAN)
INFINITY = DBL2NUM(INFINITY)
EPSILON = DBL2NUM(DBL_EPSILON)
MAX = DBL2NUM(DBL_MAX)
MIN = DBL2NUM(DBL_MIN)
MAX_10_EXP = INT2FIX(DBL_MAX_10_EXP)
MIN_10_EXP = INT2FIX(DBL_MIN_10_EXP)
MAX_EXP = INT2FIX(DBL_MAX_EXP)
MIN_EXP = INT2FIX(DBL_MIN_EXP)
DIG = INT2FIX(DBL_DIG)
MANT_DIG = INT2FIX(DBL_MANT_DIG)
RADIX = INT2FIX(FLT_RADIX)
ROUNDS = Represents the rounding mode for floating point addition. Usually defaults to 1, rounding to the nearest number. Other modes include: -1:: Indeterminable 0:: Rounding towards zero 1:: Rounding to the nearest number 2:: Rounding towards positive infinity 3: