From: zn@... Date: 2016-05-04T06:35:32+00:00 Subject: [ruby-dev:49609] [Ruby trunk Bug#12339] result of 123456789 ** -2 in doc Issue #12339 has been updated by Kazuhiro NISHIYAMA. 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` にあります。 ---------------------------------------- Bug #12339: result of 123456789 ** -2 in doc https://bugs.ruby-lang.org/issues/12339#change-58474 * Author: Kazuhiro NISHIYAMA * Status: Closed * Priority: Normal * Assignee: Kazuhiro NISHIYAMA * ruby -v: ruby 2.4.0dev (2016-05-02 trunk 54882) [x86_64-darwin14] * Backport: 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED ---------------------------------------- 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) ``` -- https://bugs.ruby-lang.org/