Project

General

Profile

Bug #10487

[PATCH 3/3] More than 3 arguments Passing to CMath.log doesn't make sense.

Added by gogotanaka (Kazuki Tanaka) over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
2.2.0dev
[ruby-core:66143]

Description

Hi, there.

I was wondering which is prefer reporting this issue as bugs or feature.
Finally I decided to report as bugs because I thought such a issue being totally unexpected can be called bugs.

Aside from that, let me show the before my patch and after my patch.

Before

CMath.log(1i,1,1,1,1,1,1,1,1)
# => (NaN+Infinity*i)

After

CMath.log(1i,1,1,1,1,1,1,1,1)
# => ArgumentError: wrong number of arguments (9 for 1..2)

def log(z, b=E) may look little bit strange, but I assert for all num log(num) equal log(num, E)

and checking second argument passing or not takes pain.

Thanks. gogo.


Files

modify_cmath.rb.patch (1.15 KB) modify_cmath.rb.patch gogotanaka (Kazuki Tanaka), 11/08/2014 07:50 PM
adjust_test_complex.rb.patch (955 Bytes) adjust_test_complex.rb.patch gogotanaka (Kazuki Tanaka), 11/08/2014 07:50 PM
update_NEWS.patch (629 Bytes) update_NEWS.patch gogotanaka (Kazuki Tanaka), 11/08/2014 07:50 PM
modify_cmath_rb_v2.patch (1.16 KB) modify_cmath_rb_v2.patch gogotanaka (Kazuki Tanaka), 01/27/2015 02:29 AM

Associated revisions

Revision 0c3a0d65
Added by gogotanaka (Kazuki Tanaka) about 4 years ago

  • lib/cmath.rb (log): raise ArgumentError when more than 2 arguments are passed. [ruby-core:66143] [Bug #10487]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 49729
Added by gogotanaka (Kazuki Tanaka) about 4 years ago

  • lib/cmath.rb (log): raise ArgumentError when more than 2 arguments are passed. [ruby-core:66143] [Bug #10487]

Revision 49729
Added by gogotanaka (Kazuki Tanaka) about 4 years ago

  • lib/cmath.rb (log): raise ArgumentError when more than 2 arguments are passed. [ruby-core:66143] [Bug #10487]

Revision 49729
Added by gogotanaka (Kazuki Tanaka) about 4 years ago

  • lib/cmath.rb (log): raise ArgumentError when more than 2 arguments are passed. [ruby-core:66143] [Bug #10487]

Revision 49729
Added by gogotanaka (Kazuki Tanaka) about 4 years ago

  • lib/cmath.rb (log): raise ArgumentError when more than 2 arguments are passed. [ruby-core:66143] [Bug #10487]

Revision 49729
Added by gogotanaka (Kazuki Tanaka) about 4 years ago

  • lib/cmath.rb (log): raise ArgumentError when more than 2 arguments are passed. [ruby-core:66143] [Bug #10487]

History

Updated by gogotanaka (Kazuki Tanaka) over 4 years ago

Only my concern is constant E can be overrided.

Updated by marcandre (Marc-Andre Lafortune) over 4 years ago

Looks good. I would use ::Math::E instead of E for explicitness (I doubt anyone would defined CMath::E.
Also, bug fixes don't need a NEWS entry.

Updated by gogotanaka (Kazuki Tanaka) over 4 years ago

@Marc-Andre Lafortune

sounds good, do I need to modify patch as you said?
If so, please feel free.

Updated by ayumin (Ayumu AIZAWA) about 4 years ago

Hi Tanaka-san
Please post new patch which was applied Marc's review.
I would help you for assign the right person of ruby-core for this issue.
Regards.

Updated by gogotanaka (Kazuki Tanaka) about 4 years ago

@Ayumu AIZAWA san

Thank you so much! Here you are.

#9

Updated by gogotanaka (Kazuki Tanaka) about 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r49729.


  • lib/cmath.rb (log): raise ArgumentError when more than 2 arguments are passed. [ruby-core:66143] [Bug #10487]

Also available in: Atom PDF