to_i

flt.to_i â integerflt.to_int â integer Instance Public methods Returns flt truncated to an Integer.

to_f

flt.to_f â self Instance Public methods As flt is already a float, returns self.

to_d

flt.to_d â bigdecimal Instance Public methods Convert flt to a BigDecimal and return it. require 'bigdecimal' require 'bigdecimal/util' 0.5.to_d # => #<BigDecimal:1dc69e0,'0.5E0',9(18)>

round

flt.round([ndigits]) â integer or float Instance Public methods Rounds flt to a given precision in decimal digits (default 0 digits). Precision may be negative. Returns a floating point number when ndigits is more than zero. 1.4.round #=> 1 1.5.round #=> 2 1.6.round #=> 2 (-1.5).round #=> -2 1.234567.round(2) #=> 1.23 1.234567.round(3) #=> 1.235 1.234567.round(4) #=> 1.2346 1.234567.round(5) #=> 1.23457 34567.89.round(-5) #=> 0

rationalize

flt.rationalize([eps]) â rational Instance Public methods Returns a simpler approximation of the value (flt-|eps| <= result <= flt+|eps|). if the optional eps is not given, it will be chosen automatically. 0.3.rationalize #=> (3/10) 1.333.rationalize #=> (1333/1000) 1.333.rationalize(0.01) #=> (4/3) See to_r.

quo

float.quo(numeric) â float Instance Public methods Returns float / numeric.

power!

power!(other) Instance Public methods Alias for: **

phase

flo.phase â 0 or float Instance Public methods Returns 0 if the value is positive, pi otherwise.

numerator

flo.numerator â integer Instance Public methods Returns the numerator. The result is machine dependent. n = 0.3.numerator #=> 5404319552844595 d = 0.3.denominator #=> 18014398509481984 n.fdiv(d) #=> 0.3

nan?

flt.nan? â true or false Instance Public methods Returns true if flt is an invalid IEEE floating point number. a = -1.0 #=> -1.0 a.nan? #=> false a = 0.0/0.0 #=> NaN a.nan? #=> true