This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

split

        # BigDecimal.split

(from ruby core)
---
    split()

---

Splits a BigDecimal number into four parts, returned as an array of
values.

The first value represents the sign of the BigDecimal, and is -1 or 1,
or 0 if the BigDecimal is Not a Number.

The second value is a string representing the significant digits of the
BigDecimal, with no leading zeros.

The third value is the base used for arithmetic (currently always 10) as
an Integer.

The fourth value is an Integer exponent.

If the BigDecimal can be represented as 0.xxxxxx*10**n, then xxxxxx is
the string of significant digits with no leading zeros, and n is the
exponent.

From these values, you can translate a BigDecimal to a float as follows:

    sign, significant_digits, base, exponent = a.split
    f = sign * "0.#{significant_digits}".to_f * (base ** exponent)

(Note that the to_f method is provided as a more convenient way to
translate a BigDecimal to a Float.)



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.