Name

Float — Floating-point number class

Synopsis

Float objects represent floating-point numbers. They use double precision floating-point numbers as internel representation of the platform architecture.

Inherited Class

Numeric

Included Module

Precision

Class Method

Float::induced_from(num)

Returns the result of converting num to a floating-point number.

Instance Methods

f.finite?

Returns true if f isn’t infinite and f.nan is false.

f.infinite?

Returns 1 if f is positive infinity, -1 if negative infinity, or nil if anything else.

f.nan?

Returns true if f isn’t a valid IEEE floating point number.

Get Ruby in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.