Issue #10378 has been updated by gogo tanaka. Tsuyoshi Sawada さん こんにちは. 22年間誤用しておりました.. お恥ずかしい. ご指摘をするのも心苦しいと察します、わざわざお伝え頂けるとは本当に嬉しく思います. お陰さまで苦手な英語を一歩前進させる事が出来ました. ありがとうございました!! 話は変わりますが、Tsuyoshi Sawada さん が面白いアイディアを沢山投稿されて、ステキだと思っています. 実際に実装されるまでは色々考えなければいけない所があるんでしょうが(もちろん僕も偉そうな事は決して言えません) 単純に考えを深めたりアイディアを生むきっかけとして僕自身大変楽しく拝見させて頂いております. 今後ともよろしくお願い致します. ---------------------------------------- Feature #10378: [PATCH 0/3] It's better (1 + 0i).real? return true https://bugs.ruby-lang.org/issues/10378#change-49647 * Author: gogo tanaka * Status: Open * Priority: Normal * Assignee: * Category: core * Target version: current: 2.2.0 ---------------------------------------- Right now, `Complex#real?` return `false` anytime. I suppose `#is_a?(Complex)` is enough to check whether a object is `Complex`'s object or not. (I have to admire `#real?` is more useful than `#is_a?(Complex)`) But what we really want to know is whether a object whose class has `Numeric` as superclass is equal to real number or not. Actually whichever is ok, modifying `#real?` or implementing as new method(e.g #real_num? ... :( Anyway, I wanna method like that for `Complex`. ```cpp static VALUE nucomp_real_p(VALUE self) { get_dat1(self); if (rb_equal(dat->imag, INT2FIX(0))) { return Qtrue; } return Qfalse; } ``` By the way, I can find two coding styles through ruby source code. Which is prefer? it doesn't matter? ```cpp if(...) return ... retrun ... ``` or ```cpp if(...) { return ... } retrun ... ``` ---Files-------------------------------- update_NEWS.patch (716 Bytes) add_tests.patch (848 Bytes) update_Complex#real_.patch (1.18 KB) -- https://bugs.ruby-lang.org/