ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-dev:50712] [Ruby trunk Bug#15426] BigDecimal: "1.2.3".to_d が 0.0 になる
       [not found] <redmine.issue-15426.20181217155400@ruby-lang.org>
@ 2018-12-17 15:54 ` tommy
  2018-12-18  1:45 ` [ruby-dev:50713] " nobu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: tommy @ 2018-12-17 15:54 UTC (permalink / raw)
  To: ruby-dev

Issue #15426 has been reported by tommy (Masahiro Tomita).

----------------------------------------
Bug #15426: BigDecimal: "1.2.3".to_d が 0.0 になる
https://bugs.ruby-lang.org/issues/15426

* Author: tommy (Masahiro Tomita)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0rc2 (2018-12-15 trunk 66408) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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 を返すのでなんか違うような気もします。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-dev:50713] [Ruby trunk Bug#15426] BigDecimal: "1.2.3".to_d が 0.0 になる
       [not found] <redmine.issue-15426.20181217155400@ruby-lang.org>
  2018-12-17 15:54 ` [ruby-dev:50712] [Ruby trunk Bug#15426] BigDecimal: "1.2.3".to_d が 0.0 になる tommy
@ 2018-12-18  1:45 ` nobu
  2018-12-18  1:46 ` [ruby-dev:50714] [Ruby trunk Bug#15426][Assigned] " nobu
  2018-12-23 14:07 ` [ruby-dev:50728] [Ruby trunk Bug#15426][Closed] " muraken
  3 siblings, 0 replies; 4+ messages in thread
From: nobu @ 2018-12-18  1:45 UTC (permalink / raw)
  To: ruby-dev

Issue #15426 has been updated by nobu (Nobuyoshi Nakada).


こんなところでしょうか。

```diff
diff --git i/ext/bigdecimal/bigdecimal.c w/ext/bigdecimal/bigdecimal.c
index 64d7f20078..052fdc57b9 100644
--- i/ext/bigdecimal/bigdecimal.c
+++ w/ext/bigdecimal/bigdecimal.c
@@ -4271,7 +4271,7 @@ VpAlloc(size_t mx, const char *szVal, int strict_p, int exc)
             while (ISSPACE(szVal[j])) ++j;
 
             /* Invalid character */
-            if (szVal[j]) {
+            if (szVal[j] && strict_p) {
                 goto invalid_value;
             }
         }
diff --git i/test/bigdecimal/test_bigdecimal_util.rb w/test/bigdecimal/test_bigdecimal_util.rb
index 04c8eb2b46..bb9ed83185 100644
--- i/test/bigdecimal/test_bigdecimal_util.rb
+++ w/test/bigdecimal/test_bigdecimal_util.rb
@@ -74,6 +74,7 @@
     assert_equal(BigDecimal('0.1'), "0.1_e10".to_d)
     assert_equal(BigDecimal('0.1'), "0.1e_10".to_d)
     assert_equal(BigDecimal('1'), "0.1e1__0".to_d)
+    assert_equal(BigDecimal('1.2'), "1.2.3".to_d)
 
     assert("2.5".to_d.frozen?)
   end
```

----------------------------------------
Bug #15426: BigDecimal: "1.2.3".to_d が 0.0 になる
https://bugs.ruby-lang.org/issues/15426#change-75747

* Author: tommy (Masahiro Tomita)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0rc2 (2018-12-15 trunk 66408) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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 を返すのでなんか違うような気もします。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [ruby-dev:50714] [Ruby trunk Bug#15426][Assigned] BigDecimal: "1.2.3".to_d が 0.0 になる
       [not found] <redmine.issue-15426.20181217155400@ruby-lang.org>
  2018-12-17 15:54 ` [ruby-dev:50712] [Ruby trunk Bug#15426] BigDecimal: "1.2.3".to_d が 0.0 になる tommy
  2018-12-18  1:45 ` [ruby-dev:50713] " nobu
@ 2018-12-18  1:46 ` nobu
  2018-12-23 14:07 ` [ruby-dev:50728] [Ruby trunk Bug#15426][Closed] " muraken
  3 siblings, 0 replies; 4+ messages in thread
From: nobu @ 2018-12-18  1:46 UTC (permalink / raw)
  To: ruby-dev

Issue #15426 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Assigned
Assignee set to mrkn (Kenta Murata)

----------------------------------------
Bug #15426: BigDecimal: "1.2.3".to_d が 0.0 になる
https://bugs.ruby-lang.org/issues/15426#change-75748

* Author: tommy (Masahiro Tomita)
* Status: Assigned
* Priority: Normal
* Assignee: mrkn (Kenta Murata)
* Target version: 
* ruby -v: ruby 2.6.0rc2 (2018-12-15 trunk 66408) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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 を返すのでなんか違うような気もします。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-dev:50728] [Ruby trunk Bug#15426][Closed] BigDecimal: "1.2.3".to_d が 0.0 になる
       [not found] <redmine.issue-15426.20181217155400@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2018-12-18  1:46 ` [ruby-dev:50714] [Ruby trunk Bug#15426][Assigned] " nobu
@ 2018-12-23 14:07 ` muraken
  3 siblings, 0 replies; 4+ messages in thread
From: muraken @ 2018-12-23 14:07 UTC (permalink / raw)
  To: ruby-dev

Issue #15426 has been updated by mrkn (Kenta Murata).

Status changed from Assigned to Closed

bigdecimal 1.4.0.pre.20181220a で修正しました。

----------------------------------------
Bug #15426: BigDecimal: "1.2.3".to_d が 0.0 になる
https://bugs.ruby-lang.org/issues/15426#change-75856

* Author: tommy (Masahiro Tomita)
* Status: Closed
* Priority: Normal
* Assignee: mrkn (Kenta Murata)
* Target version: 
* ruby -v: ruby 2.6.0rc2 (2018-12-15 trunk 66408) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
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 を返すのでなんか違うような気もします。



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-23 14:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15426.20181217155400@ruby-lang.org>
2018-12-17 15:54 ` [ruby-dev:50712] [Ruby trunk Bug#15426] BigDecimal: "1.2.3".to_d が 0.0 になる tommy
2018-12-18  1:45 ` [ruby-dev:50713] " nobu
2018-12-18  1:46 ` [ruby-dev:50714] [Ruby trunk Bug#15426][Assigned] " nobu
2018-12-23 14:07 ` [ruby-dev:50728] [Ruby trunk Bug#15426][Closed] " muraken

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).