Module: Exchange::MRI210Patch
- Defined in:
- lib/exchange/core_extensions/big_decimal/mri_2_1_0_patch.rb
Overview
Instance Method Summary collapse
-
#/(other) ⇒ Object
(also: #div)
A patch for www.ruby-forum.com/topic/4419577 Since the division values are off for values < 1, multiply the BigDecimal instance by its precision.
Instance Method Details
#/(other) ⇒ Object Also known as: div
A patch for www.ruby-forum.com/topic/4419577 Since the division values are off for values < 1, multiply the BigDecimal instance by its precision
10 11 12 13 14 15 16 17 |
# File 'lib/exchange/core_extensions/big_decimal/mri_2_1_0_patch.rb', line 10 def / other if other.is_a?(BigDecimal) && other < 1 precision = 10 * precs.first (self * precision) / (other * precision) else super end end |