[#65451] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...
Issue #10333 has been updated by Koichi Sasada.
9 messages
2014/10/07
[#65458] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— Eric Wong <normalperson@...>
2014/10/07
[email protected] wrote:
[#65502] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— Eric Wong <normalperson@...>
2014/10/08
Eric Wong <[email protected]> wrote:
[#65538] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— Eric Wong <normalperson@...>
2014/10/09
Eric Wong <[email protected]> wrote:
[#65549] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— SASADA Koichi <ko1@...>
2014/10/09
On 2014/10/09 11:04, Eric Wong wrote:
[#65551] Re: [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string
— Eric Wong <normalperson@...>
2014/10/09
SASADA Koichi <[email protected]> wrote:
[#65453] [ruby-trunk - Feature #10328] [PATCH] make OPT_SUPPORT_JOKE a proper VM option — ko1@...
Issue #10328 has been updated by Koichi Sasada.
3 messages
2014/10/07
[#65559] is there a name for this? — Xavier Noria <fxn@...>
When describing stuff about constants (working in their guide), you often
7 messages
2014/10/09
[#65560] Re: is there a name for this?
— Nobuyoshi Nakada <nobu@...>
2014/10/09
On 2014/10/09 20:41, Xavier Noria wrote:
[#65561] Re: is there a name for this?
— Xavier Noria <fxn@...>
2014/10/09
On Thu, Oct 9, 2014 at 1:59 PM, Nobuyoshi Nakada <[email protected]> wrote:
[#65566] [ruby-trunk - Feature #10351] [Open] [PATCH] prevent CVE-2014-6277 — shyouhei@...
Issue #10351 has been reported by Shyouhei Urabe.
3 messages
2014/10/09
[#65741] Re: [ruby-cvs:55121] normal:r47971 (trunk): test/ruby/test_rubyoptions.rb: fix race — Nobuyoshi Nakada <nobu@...>
On 2014/10/16 10:10, [email protected] wrote:
5 messages
2014/10/16
[#65742] Re: [ruby-cvs:55121] normal:r47971 (trunk): test/ruby/test_rubyoptions.rb: fix race
— Eric Wong <normalperson@...>
2014/10/16
Nobuyoshi Nakada <[email protected]> wrote:
[#65750] Re: [ruby-cvs:55121] normal:r47971 (trunk): test/ruby/test_rubyoptions.rb: fix race
— Tanaka Akira <akr@...>
2014/10/16
2014-10-16 12:48 GMT+09:00 Eric Wong <[email protected]>:
[#65753] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...
Issue #10333 has been updated by Koichi Sasada.
3 messages
2014/10/16
[#65818] [ruby-trunk - Feature #10351] [PATCH] prevent CVE-2014-6277 — shyouhei@...
Issue #10351 has been updated by Shyouhei Urabe.
3 messages
2014/10/20
[ruby-core:66028] [ruby-trunk - Feature #10378] [PATCH 0/3] It's better (1 + 0i).real? return true
From:
t_nissie@...
Date:
2014-10-31 01:20:57 UTC
List:
ruby-core #66028
Issue #10378 has been updated by Takeshi Nishimatsu.
> to know whether a object whose class has Numeric as superclass is equal to real number or not.
Simplly, `a.real? || a.imag.zero?` may be enough for me, so far.
```
irb(main):016:0> a = 2.16
=> 2.16
irb(main):017:0> a.real? || a.imag.zero?
=> true
irb(main):018:0> a = Complex(1.0,-0.0)
=> (1.0-0.0i)
irb(main):019:0> a.real? || a.imag.zero?
=> true
```
Sorry, but I cannot find any reason to change the current
definition of `Numeric#real?` and to define a new method.
----------------------------------------
Feature #10378: [PATCH 0/3] It's better (1 + 0i).real? return true
https://bugs.ruby-lang.org/issues/10378#change-49748
* 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/