Skip to content
  • Jeremy Evans's avatar
    b9ef35e4
    Implement Complex#<=> · b9ef35e4
    Jeremy Evans authored
    Implement Complex#<=> so that it is usable as an argument when
    calling <=> on objects of other classes (since #coerce will coerce
    such numbers to Complex).  If the complex number has a zero imaginary
    part, and the other argument is a real number (or complex number with
    zero imaginary part), return -1, 0, or 1.  Otherwise, return nil,
    indicating the objects are not comparable.
    
    Fixes [Bug #15857]
    b9ef35e4
    Implement Complex#<=>
    Jeremy Evans authored
    Implement Complex#<=> so that it is usable as an argument when
    calling <=> on objects of other classes (since #coerce will coerce
    such numbers to Complex).  If the complex number has a zero imaginary
    part, and the other argument is a real number (or complex number with
    zero imaginary part), return -1, 0, or 1.  Otherwise, return nil,
    indicating the objects are not comparable.
    
    Fixes [Bug #15857]
Loading