Project

General

Profile

Actions

Bug #15426

closed

BigDecimal: "1.2.3".to_d が 0.0 になる

Added by tommy (Masahiro Tomita) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.6.0rc2 (2018-12-15 trunk 66408) [x86_64-linux]
[ruby-dev:50712]

Description

Ruby 2.6.0-rc2 で "1.2.3".to_d が 0.0 になります。

% ruby -v -rbigdecimal -rbigdecimal/util -e 'p "1.2.3".to_d'
ruby 2.6.0rc2 (2018-12-15 trunk 66408) [x86_64-linux]
0.0

Ruby 2.5.3p105 では 0.12e1 を返してました。

% ruby -v -rbigdecimal -rbigdecimal/util -e 'p "1.2.3".to_d'
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
0.12e1

NEWS の

* String#to_d parses the receiver string like String#to_f.

この記述がそうなのかと思ったのですが、"1.2.3".to_f は 1.2 を返すのでなんか違うような気もします。

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0