Ruby 2.1.1 BigDecimal patch backported from https://bugs.ruby-lang.org/issues/9657#note-8