From: merch-redmine@... Date: 2019-06-05T04:55:13+00:00 Subject: [ruby-core:92970] [Ruby trunk Bug#15857] <=> の右辺が <=> を実装していない場合の振る舞い Issue #15857 has been updated by jeremyevans0 (Jeremy Evans). File complex-real-spaceship.patch added I agree that this is a bug. `Complex#<=>` should be implemented, even if it did return `nil` for all arguments. However, I think Complex numbers with an imaginary part of zero should be treated as real numbers, and that `Complex#real?` should return `true` for such numbers. Likewise, `Complex#<=>` should return 1, 0, or -1 if both the receiver and the argument are real numbers (treating Complex instances with an imaginary part of zero as real numbers). However, if the receiver or the argument is not a real number, then it should return `nil`. Attached is a patch that implements the behavior described above. ---------------------------------------- Bug #15857: <=> ������������ <=> ��������������������������������������������� https://bugs.ruby-lang.org/issues/15857#change-78348 * Author: shuujii (Shuji KOBAYASHI) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- `<=>` ������������ `<=>` ���������������������������������`nil` ��������������������������������������������������������������������������������������������������������������������������������������������� ```ruby 0 <=> 0i #=> NoMethodError (undefined method `<=>' for (0+0i):Complex) 0 <=> BasicObject.new #=> nil :a <=> 0i #=> nil "a" <=> 0i #=> NoMethodError (undefined method `<=>' for (0+0i):Complex) ``` ���������`0 <=> 0i` ������������������`0 == 0i` ��� `true` ��������������������������������������������������������������������������������������������������� ---Files-------------------------------- complex-real-spaceship.patch (8.75 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: