Answer the question
In order to leave comments, you need to log in
Comparing object_id for float values?
There is a code:
a = 0.1
b = 0.1
a.object_id == b.object_id
Answer the question
In order to leave comments, you need to log in
Different versions of ruby? Ruby 2 optimized float
# Ruby 1.9
4.2.object_id == 4.2.object_id # => false
# Ruby 2.0
warn "Optimization only on 64 bit systems" unless 42.size * 8 == 64
4.2.object_id == 4.2.object_id # => true (4.2 is immediate)
4.2e100.object_id == 4.2e100.object_id # => false (4.2e100 isn't)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question