Type:
Class
Constants:
ROUNDS : INT2FIX(FLT_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

Rounding towards negative infinity

RADIX : INT2FIX(FLT_RADIX)

The base of the floating point, or number of unique digits used to represent the number.

Usually defaults to 2 on most systems, which would represent a base-10 decimal.

MANT_DIG : INT2FIX(DBL_MANT_DIG)

The number of base digits for the double data type.

Usually defaults to 53.

DIG : INT2FIX(DBL_DIG)

The number of decimal digits in a double-precision floating point.

Usually defaults to 15.

MIN_EXP : INT2FIX(DBL_MIN_EXP)

The smallest posable exponent value in a double-precision floating point.

Usually defaults to -1021.

MAX_EXP : INT2FIX(DBL_MAX_EXP)

The largest possible exponent value in a double-precision floating point.

Usually defaults to 1024.

MIN_10_EXP : INT2FIX(DBL_MIN_10_EXP)

The smallest negative exponent in a double-precision floating point where 10 raised to this power minus 1.

Usually defaults to -307.

MAX_10_EXP : INT2FIX(DBL_MAX_10_EXP)

The largest positive exponent in a double-precision floating point where 10 raised to this power minus 1.

Usually defaults to 308.

MIN : DBL2NUM(DBL_MIN)

The smallest positive integer in a double-precision floating point.

Usually defaults to 2.2250738585072014e-308.

MAX : DBL2NUM(DBL_MAX)

The largest possible integer in a double-precision floating point number.

Usually defaults to 1.7976931348623157e+308.

EPSILON : DBL2NUM(DBL_EPSILON)

The difference between 1 and the smallest double-precision floating point number.

Usually defaults to 2.2204460492503131e-16.

INFINITY : DBL2NUM(INFINITY)

An expression representing positive infinity.

NAN : DBL2NUM(NAN)

An expression representing a value which is ânot a numberâ.

When mathn is required, Float is changed to handle Complex numbers.

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

Floating point has a different arithmetic and is a inexact number. So you should know its esoteric system. see following:

-@
  • References/Ruby on Rails/Ruby/Classes/Float

-float â float Instance Public methods Returns float, negated.

2025-01-10 15:47:30
coerce
  • References/Ruby on Rails/Ruby/Classes/Float

flt.coerce(numeric) â array Instance Public methods Returns an array with

2025-01-10 15:47:30
ceil
  • References/Ruby on Rails/Ruby/Classes/Float

flt.ceil â integer Instance Public methods Returns the smallest Integer

2025-01-10 15:47:30
%
  • References/Ruby on Rails/Ruby/Classes/Float

float % other â float Instance Public methods Return the modulo after

2025-01-10 15:47:30
>=
  • References/Ruby on Rails/Ruby/Classes/Float

flt >= real â true or false Instance Public methods true

2025-01-10 15:47:30
modulo
  • References/Ruby on Rails/Ruby/Classes/Float

float.modulo(other) â float Instance Public methods Return the modulo after

2025-01-10 15:47:30
to_f
  • References/Ruby on Rails/Ruby/Classes/Float

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

2025-01-10 15:47:30
arg
  • References/Ruby on Rails/Ruby/Classes/Float

flo.arg â 0 or float Instance Public methods Returns 0 if the value is positive

2025-01-10 15:47:30
+
  • References/Ruby on Rails/Ruby/Classes/Float

float + other â float Instance Public methods Returns a new float which is

2025-01-10 15:47:30
to_d
  • References/Ruby on Rails/Ruby/Classes/Float

flt.to_d â bigdecimal Instance Public methods Convert flt to

2025-01-10 15:47:30