Issue #13848 has been updated by shevegen (Robert A. Heiler).


I believe you mean for BigDecimal.new('200.') to be equivalent to BigDecimal.new('200.0')?

I could see both ways be ok; there may be use cases where the error is better because of
the user not being explicit enough; or the user does not want to have to type in the
trailing '0'. So I can't say whether this is really a bug or not, it may be specifically
wanted to be that way.

I guess if there are no trade offs though, then I'd agree with the proposal if you meant
that it is the same to mean for a trailing '0' there - but I could also see for purity
to require the '0' to be passed.

What about input such as:

    BigDecimal.new('0.')

I mean it will be 0 anyway... it reads strangely to omit the the '0' to my eyes though ...

Latest docu can be found here, if anyone else is interested:

  https://ruby-doc.org/stdlib/libdoc/bigdecimal/rdoc/BigDecimal.html


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

* 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/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>