Class

Float

Extends:

Includes:

Float objects represent real numbers using the native architecture’s double-precision floating point representation.

Constants
DIG
EPSILON
MANT_DIG
MAX
MAX_10_EXP
MAX_EXP
MIN
MIN_10_EXP
MIN_EXP
RADIX
ROUNDS
Public Methods
% Return the modulo after division of flt by other.
* Returns a new float which is the product of float and other.
** flt ** other => float
+ Returns a new float which is the sum of float and other.
- Returns a new float which is the difference of float and other.
-@ Returns float, negated.
/ Returns a new float which is the result of dividing float by other.
< true if flt is less than other.
<= true if flt is less than or equal to other.
<=> Returns -1, 0, or +1 depending on whether flt is less than, equal to, or greater than numeric. This is the basis for the tests in Comparable.
== Returns true only if obj has the same value as flt. Contrast this with Float#eql?, which requires obj to be a Float.
> true if flt is greater than other.
>= true if flt is greater than or equal to other.
abs Returns the absolute value of flt.
ceil Returns the smallest Integer greater than or equal to flt.
coerce MISSING: documentation
divmod See Numeric#divmod.
eql? Returns true only if obj is a Float with the same value as flt. Contrast this with Float#==, which performs type conversions.
finite? Returns true if flt is a valid IEEE floating point number (it is not infinite, and nan? is false).
floor Returns the largest integer less than or equal to flt.
hash Returns a hash code for this float.
induced_from Convert obj to a float.
infinite? Returns nil, -1, or +1 depending on whether flt is finite, -infinity, or +infinity.
modulo Return the modulo after division of flt by other.
nan? Returns true if flt is an invalid IEEE floating point number.
round Rounds flt to the nearest integer. Equivalent to:
to_f As flt is already a float, returns self.
to_i Returns flt truncated to an Integer.
to_int Returns flt truncated to an Integer.
to_s Returns a string containing a representation of self. As well as a fixed or exponential form of the number, the call may return ``NaN’’, ``Infinity’’, and ``-Infinity’’.
truncate Returns flt truncated to an Integer.
zero? Returns true if flt is 0.0.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.