From: merch-redmine@... Date: 2020-07-17T21:44:04+00:00 Subject: [ruby-core:99208] [Ruby master Bug#17032] BigDecimal's `to_d` behaves inconsistent compared to `to_f` Issue #17032 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Closed `NilClass#to_d` was added in Ruby 2.6. As it is not security-related (and seems more like a new feature than a bug fix), it will not be backported to Ruby 2.5, as that is in security maintenance mode. ---------------------------------------- Bug #17032: BigDecimal's `to_d` behaves inconsistent compared to `to_f` https://bugs.ruby-lang.org/issues/17032#change-86586 * Author: TiloS (Tilo S) * Status: Closed * Priority: Normal * ruby -v: 2.5.5 * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- I would expect `to_f` and `to_d` to behave identically. Specifically, `nil.to_d` should behave like `nil.to_f`. ```ruby require 'bigdecimal' require 'bigdecimal/util' nil.to_f # => 0.0 nil.to_d # >> NoMethodError (undefined method `to_d' for nil:NilClass) ``` Users should not have to resort to this: ```ruby nil.to_f.to_d # => 0.0 ``` -- https://bugs.ruby-lang.org/ Unsubscribe: