[#65451] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...
Issue #10333 has been updated by Koichi Sasada.
ko1@atdot.net wrote:
Eric Wong <normalperson@yhbt.net> wrote:
Eric Wong <normalperson@yhbt.net> wrote:
On 2014/10/09 11:04, Eric Wong wrote:
SASADA Koichi <ko1@atdot.net> wrote:
[#65453] [ruby-trunk - Feature #10328] [PATCH] make OPT_SUPPORT_JOKE a proper VM option — ko1@...
Issue #10328 has been updated by Koichi Sasada.
[#65559] is there a name for this? — Xavier Noria <fxn@...>
When describing stuff about constants (working in their guide), you often
On 2014/10/09 20:41, Xavier Noria wrote:
On Thu, Oct 9, 2014 at 1:59 PM, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
[#65566] [ruby-trunk - Feature #10351] [Open] [PATCH] prevent CVE-2014-6277 — shyouhei@...
Issue #10351 has been reported by Shyouhei Urabe.
[#65741] Re: [ruby-cvs:55121] normal:r47971 (trunk): test/ruby/test_rubyoptions.rb: fix race — Nobuyoshi Nakada <nobu@...>
On 2014/10/16 10:10, normal@ruby-lang.org wrote:
Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
2014-10-16 12:48 GMT+09:00 Eric Wong <normalperson@yhbt.net>:
[#65753] [ruby-trunk - Feature #10333] [PATCH 3/1] optimize: "yoda literal" == string — ko1@...
Issue #10333 has been updated by Koichi Sasada.
[#65818] [ruby-trunk - Feature #10351] [PATCH] prevent CVE-2014-6277 — shyouhei@...
Issue #10351 has been updated by Shyouhei Urabe.
[ruby-core:65939] [ruby-trunk - Feature #10378] [PATCH 0/3] It's better (1 + 0i).real? return true
Issue #10378 has been updated by Takeshi Nishimatsu.
Objection.
Especially for Float, Complex(1.0,0.0) and Complex(1.0,-0.0) have meanings:
sqrt[-x+i(+0)]=i*sqrt(x)
sqrt[-x+i(-0)]=-i*sqrt(x)
So, they are complex. Not real.
And, please see the man page of cproj(3), though cproj is not implemented in Ruby.
Please see Goldberg's review.
http://docs.oracle.com/cd/E19957-01/806-4847/ncg_goldberg.html (EUC encoded)
http://iss.ndl.go.jp/books/R100000039-I001404293-00
@article{goldberg1991ecs,
title={What every computer scientist should know about floating-point arithmetic},
author={David Goldberg},
journal={ACM Computing Surveys},
volume={23},
number={1},
pages={5--48},
year={1991}}
http://dl.acm.org/citation.cfm?id=103163
This good review is also linked from https://bugs.ruby-lang.org/projects/ruby/wiki/HowToReportJa .
BTW, I do not like
-1.0-0.0i => (-1.0+0.0i) ,
though I know that it is translated as
-1.0-0.0i => Complex(-1.0,0.0)-Complex(0.0,-0.0) => (-1.0+0.0i) .
----------------------------------------
Feature #10378: [PATCH 0/3] It's better (1 + 0i).real? return true
https://bugs.ruby-lang.org/issues/10378#change-49677
* 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/