Skip to content

Instantly share code, notes, and snippets.

View lalithr95's full-sized avatar
🎯
Focusing

Lalith Rallabhandi lalithr95

🎯
Focusing
View GitHub Profile
@lalithr95
lalithr95 / integer.rb
Created October 7, 2017 03:31 — forked from pithyless/integer.rb
Ruby Integer::MAX and Integer::MIN
class Integer
N_BYTES = [42].pack('i').size
N_BITS = N_BYTES * 16
MAX = 2 ** (N_BITS - 2) - 1
MIN = -MAX - 1
end
p Integer::MAX #=> 4611686018427387903
p Integer::MAX.class #=> Fixnum
p (Integer::MAX + 1).class #=> Bignum