save_exception_mode

BigDecimal.save_exception_mode { ... } Class Public methods Excecute the provided block, but preserve the exception mode BigDecimal.save_exception_mode do BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) BigDecimal.new(BigDecimal('Infinity')) BigDecimal.new(BigDecimal('-Infinity')) BigDecimal(BigDecimal.new('NaN')) end For use with the BigDecimal::EXCEPTION_* See ::mode

save_limit

BigDecimal.save_limit { ... } Class Public methods Excecute the provided block, but preserve the precision limit BigDecimal.limit(100) puts BigDecimal.limit BigDecimal.save_limit do BigDecimal.limit(200) puts BigDecimal.limit end puts BigDecimal.limit

save_rounding_mode

BigDecimal.save_rounding_mode { ... } Class Public methods Excecute the provided block, but preserve the rounding mode BigDecimal.save_exception_mode do BigDecimal.mode(BigDecimal::ROUND_MODE, :up) puts BigDecimal.mode(BigDecimal::ROUND_MODE) end For use with the BigDecimal::ROUND_* See ::mode

ver

ver() Class Public methods Returns the BigDecimal version number.

%

a % b Instance Public methods Returns the modulus from dividing by b. See #divmod.

*

mult(value, digits) Instance Public methods Multiply by the specified value. e.g. c = a.mult(b,n) c = a * b digits If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to ::mode.

**

big_decimal ** exp â big_decimal Instance Public methods It is a synonym of #power.

+

add(value, digits) Instance Public methods Add the specified value. e.g. c = a.add(b,n) c = a + b digits If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to ::mode.

+@

+@ Instance Public methods Return self. e.g. b = +a # b == a

-

sub(value, digits) Instance Public methods Subtract the specified value. e.g. c = a.sub(b,n) c = a - b digits If specified and less than the number of significant digits of the result, the result is rounded to that number of digits, according to ::mode.