Project

General

Profile

Actions

Bug #12339

closed

result of 123456789 ** -2 in doc

Added by znz (Kazuhiro NISHIYAMA) almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
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)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0