module MudratProjector::BankerRounding

Public Instance Methods

with_banker_rounding() { || ... } click to toggle source
# File lib/mudrat_projector/banker_rounding.rb, line 3
def with_banker_rounding
  old_rounding_mode = BigDecimal.mode BigDecimal::ROUND_MODE
  BigDecimal.mode BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN
  yield
ensure
  BigDecimal.mode BigDecimal::ROUND_MODE, old_rounding_mode
end