Ruby supports integers and floating point numbers. Integers can be any length (up to a maximum determined by the amount of free memory on your system). Integers within a certain range (normally -230 to 230-1 or -262 to 262-1) are held internally in binary form, and are objects of class Fixnum. Integers outside this range are stored in objects of class Bignum (currently implemented as a variable-length set of short integers). This process is transparent, and Ruby automatically manages the conversion back and forth.
num = 8 7.times do print num.type, " ", num, "\n" num *= num end
We believe that every being is divine, is God. Every soul is a sun covered over with clouds of ignorance; the difference between soul and soul is owing to the difference in density of these layers of clouds. - Swami Vivekananda
posted 9 years ago
Ruby is the first language I have used heavily where I don't even bother to remember what values fit in a Fixnum. The language deals elegantly enough with values that I can use my brain space for something else.