[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>
Currently, ruby/spec is maintained mostly by individuals and enjoys the
13 messages
2016/12/13
[#78963] Re: ruby/spec needs help from CRuby committers
— Urabe Shyouhei <shyouhei@...>
2017/01/04
I did ask attendees of last developer meeting to join this
[#78642] Re: ruby/spec needs help from CRuby committers
— Eric Wong <normalperson@...>
2016/12/14
Benoit Daloze <eregontp@gmail.com> wrote:
[ruby-core:78570] [Ruby trunk Bug#11947][Closed] BigDecimal#coerce: unexpected behavior with Float
From:
muraken@...
Date:
2016-12-10 06:36:15 UTC
List:
ruby-core #78570
Issue #11947 has been updated by Kenta Murata.
Status changed from Assigned to Closed
This fixed on the current master branch of [ruby/bigdecimal](https://github.com/ruby/bigdecimal) repository.
So I close this issue.
----------------------------------------
Bug #11947: BigDecimal#coerce: unexpected behavior with Float
https://bugs.ruby-lang.org/issues/11947#change-61955
* Author: Lionel PERRIN
* Status: Closed
* Priority: Normal
* Assignee: Kenta Murata
* ruby -v:
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
I've noticed that:
~~~
BigDecimal('2') + 1 # => BigDecimal(3), OK
1 + BigDecimal('2') # => BigDecimal(3), OK
# whereas
BigDecimal('2') + 1.1 # => BigDecimal(3.1), OK
1.1 + BigDecimal('2') # => Float(3.1), WHY?
~~~
I was expecting the latest to return a BigDecimal but it retuns a Float. In the unit tests for bigdecimal, one can find the following test:
~~~
assert_equal(2, 1 + BigDecimal.new("1"), '[ruby-core:25697]')
~~~
May be this behavior is required but I haven't found any reason for this.
Regards,
Lionel
--
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>