LoginSignup
1
0

More than 5 years have passed since last update.

ruby2.0から、 同Floatが同じobject_idを返す・・・事が多くなった

Last updated at Posted at 2013-05-13

64bit環境下且つ、あんまでかくない値の時なのかな?

そうすると、equal?がtrueを返します。
個人的に == であっても equal? じゃないみたいなチェックにFloat使ってたので、コケるテストは幾つかありました。

1.9.3まで

1.0.equal? 1.0 #=> false

2.0だと

1.0.equal? 1.0 #=> true

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0