Method: BigDecimal.save_exception_mode
- Defined in:
- bigdecimal.c
.save_exception_mode { ... } ⇒ Object
Execute 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(BigDecimal('Infinity'))
BigDecimal(BigDecimal('-Infinity'))
BigDecimal(BigDecimal('NaN'))
end
For use with the BigDecimal::EXCEPTION_*
See BigDecimal.mode
3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 |
# File 'bigdecimal.c', line 3845
static VALUE
BigDecimal_save_exception_mode(VALUE self)
{
unsigned short const exception_mode = VpGetException();
int state;
VALUE ret = rb_protect(rb_yield, Qnil, &state);
VpSetException(exception_mode);
if (state) rb_jump_tag(state);
return ret;
}
|