Forum: Ruby Re: ruby-nuby bytes question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-02-07 20:38
(Received via mailing list)
Dear Steven,

there are no integers in Ruby, only Fixnum and Bignum.
The conversion is automatical.
Matz, Ruby's creator, says that you should use these without
caring about their internal representation.

You can find some detail on this website:

_http://www.oreillynet.com/ruby/blog/2006/01/the_ru...
(http://www.oreillynet.com/ruby/blog/2006/01/the_ru...)

If you want to know how many bytes are used to represent a
number, you can use

puts 1.size  => 4 bytes on my machine
puts 1.class => Fixnum
puts (2**3000).size => 376 bytes on my machine.
puts (2**3000).class => Bignum

Best regards,

Axel
This topic is locked and can not be replied to.