ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: ded@ddoherty.net
To: ruby-core@ruby-lang.org
Subject: [ruby-core:82534] [Ruby trunk Bug#13848] BigDecimal.new('200.') raises an exception
Date: Wed, 30 Aug 2017 11:21:43 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-66343.20170830112142.8f87a11310e64779@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13848.20170829122454@ruby-lang.org

Issue #13848 has been updated by ddoherty03 (Daniel Doherty).


Robert, yes, I think it should be the same as BigDecimal.new('200.').  The problem arises, not when a programmer is typing the number---requiring a programmer to be explicit is OK by me---but when strings are processed that come from a user of the code.

ss = '200.' # Read from a user-prepared file.
BigDecimal.new(ss) => ArgumentError ...

As it is, the programmer has to massage every string to recognize a reasonable, albeit a bit sloppy, string that is clearly meant as a valid number.

Regards,


----------------------------------------
Bug #13848: BigDecimal.new('200.') raises an exception
https://bugs.ruby-lang.org/issues/13848#change-66343

* Author: ddoherty03 (Daniel Doherty)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
BigDecimal.new('200.') raises an exception:

ArgumentError: invalid value for BigDecimal(): "200."

It should accept this as a valid decimal number.

This requires fixing numbers read in from the wild.



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

  parent reply	other threads:[~2017-08-30 11:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-13848.20170829122454@ruby-lang.org>
2017-08-29 12:24 ` [ruby-core:82512] [Ruby trunk Bug#13848] BigDecimal.new('200.') raises an exception ded
2017-08-29 17:23 ` [ruby-core:82514] " shevegen
2017-08-30 11:21 ` ded [this message]
2017-09-07  0:26 ` [ruby-core:82686] " xkernigh
2017-12-13 15:26 ` [ruby-core:84237] [Ruby trunk Bug#13848][Assigned] " muraken
2018-12-07  2:24 ` [ruby-core:90352] [Ruby trunk Bug#13848][Closed] " muraken

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-66343.20170830112142.8f87a11310e64779@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).