Type:
Class

Bignum objects hold integers outside the range of Fixnum. Bignum objects are created automatically when integer calculations would otherwise overflow a Fixnum. When a calculation involving Bignum objects returns a result that will fit in a Fixnum, the result is automatically converted.

For the purposes of the bitwise operations and [], a Bignum is treated as if it were an infinite-length bitstring with 2's complement representation.

While Fixnum values are immediate, Bignum objects are not—assignment and parameter passing work with references to objects, not the objects themselves.

When mathn is required Bignum's division and exponentiation are enhanced to return more precise values from mathematical expressions.

to_f
  • References/Ruby on Rails/Ruby/Classes/Bignum

big.to_f â float Instance Public methods Converts big to a Float

2025-01-10 15:47:30
to_s
  • References/Ruby on Rails/Ruby/Classes/Bignum

big.to_s(base=10) â string Instance Public methods Returns a string containing

2025-01-10 15:47:30
<<
  • References/Ruby on Rails/Ruby/Classes/Bignum

big Instance Public methods Shifts big

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

big >> numeric â integer Instance Public methods Shifts big right

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

big >= real â true or false Instance Public methods Returns true

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

big + other â Numeric Instance Public methods Adds big and other, returning

2025-01-10 15:47:30
/ 2
  • References/Ruby on Rails/Ruby/Classes/Bignum

big / other â Numeric Instance Public methods Performs division: the class

2025-01-10 15:47:30
even?
  • References/Ruby on Rails/Ruby/Classes/Bignum

big.even? â true or false Instance Public methods Returns true

2025-01-10 15:47:30