Project

General

Profile

Bug #12339

result of 123456789 ** -2 in doc

Added by znz (Kazuhiro NISHIYAMA) about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-05-02 trunk 54882) [x86_64-darwin14]
[ruby-dev:49606]

Description

https://github.com/ruby/ruby/blob/c353ec0c9e8e941f49910a51f7dc10cf3d3cdd17/numeric.c#L3647
Integer#** の rdoc で

 *    123456789 ** -2     #=> 6.5610001194102e-17

となっていますが、実際に試してみると (1/15241578750190521) になります。
どちらが正しいのでしょうか?

%  ruby -ve 'p 123456789 ** -2'
ruby 2.4.0dev (2016-05-02 trunk 54882) [x86_64-darwin14]
(1/15241578750190521)

Associated revisions

Revision 8ef6dacb
Added by kazu about 3 years ago

Update result of 123456789 ** -2

  • numeric.c: [DOC] Update result of 123456789 ** -2. [ruby-dev:49606] [Bug #12339]

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

Revision 54898
Added by znz (Kazuhiro NISHIYAMA) about 3 years ago

Update result of 123456789 ** -2

  • numeric.c: [DOC] Update result of 123456789 ** -2. [ruby-dev:49606] [Bug #12339]

Revision 54898
Added by kazu about 3 years ago

Update result of 123456789 ** -2

  • numeric.c: [DOC] Update result of 123456789 ** -2. [ruby-dev:49606] [Bug #12339]

Revision 54898
Added by kazu about 3 years ago

Update result of 123456789 ** -2

  • numeric.c: [DOC] Update result of 123456789 ** -2. [ruby-dev:49606] [Bug #12339]

Revision 54898
Added by kazu about 3 years ago

Update result of 123456789 ** -2

  • numeric.c: [DOC] Update result of 123456789 ** -2. [ruby-dev:49606] [Bug #12339]

Revision ac5ffe0a
Added by nagachika (Tomoyuki Chikanaga) about 3 years ago

merge revision(s) 54898: [Backport #12339]

    * bignum.c: [DOC] Update result of 123456789 ** -2.
      [ruby-dev:49606] [Bug #12339]

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

Revision 54922
Added by nagachika (Tomoyuki Chikanaga) about 3 years ago

merge revision(s) 54898: [Backport #12339]

* bignum.c: [DOC] Update result of 123456789 ** -2.
  [ruby-dev:49606] [Bug #12339]

Revision 1511ef08
Added by usa (Usaku NAKAMURA) about 3 years ago

merge revision(s) 54898: [Backport #12339]

    * bignum.c: [DOC] Update result of 123456789 ** -2.
      [ruby-dev:49606] [Bug #12339]

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

Revision 55350
Added by usa (Usaku NAKAMURA) about 3 years ago

merge revision(s) 54898: [Backport #12339]

* bignum.c: [DOC] Update result of 123456789 ** -2.
  [ruby-dev:49606] [Bug #12339]

History

Updated by nobu (Nobuyoshi Nakada) about 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to znz (Kazuhiro NISHIYAMA)
  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED

1.9でRationalが組み込みになって動作が変わったはずです。

#2

Updated by Anonymous about 3 years ago

  • Status changed from Assigned to Closed

Applied in changeset r54898.


Update result of 123456789 ** -2

  • numeric.c: [DOC] Update result of 123456789 ** -2. [ruby-dev:49606] [Bug #12339]

Updated by nagachika (Tomoyuki Chikanaga) about 3 years ago

  • Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONTNEED

該当する部分は r54831 で Fixnum/Bignum メソッドの統合時に書き加えられていて、ruby_2_3 以前のブランチの rdoc 用コメントには存在しませんでした。また 1 ** -2 の例は正しく (1/2) の表記になっていました。

Updated by znz (Kazuhiro NISHIYAMA) about 3 years ago

  • Backport changed from 2.1: DONTNEED, 2.2: DONTNEED, 2.3: DONTNEED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED

Bignum#** からのマージなので、ruby_2_3 以前のブランチでは rb_big_pow にあります。

Updated by nagachika (Tomoyuki Chikanaga) about 3 years ago

なるほどその通りでした。指摘ありがとうございます。

Updated by nagachika (Tomoyuki Chikanaga) about 3 years ago

  • Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE

ruby_2_3 r54922 merged revision(s) 54898.

Updated by usa (Usaku NAKAMURA) about 3 years ago

  • Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE to 2.1: REQUIRED, 2.2: DONE, 2.3: DONE

ruby_2_2 r55350 merged revision(s) 54898.

Also available in: Atom PDF