/* call-seq:
* BigDecimal.limit(digits)
*
* Limit the number of significant digits in newly created BigDecimal
* numbers to the specified value. Rounding is performed as necessary,
* as specified by BigDecimal.mode.
*
* A limit of 0, the default, means no upper limit.
*
* The limit specified by this method takes priority over any limit
* specified to instance methods such as ceil, floor, truncate, or round.
*/
static VALUE
BigDecimal_limit(int argc, VALUE *argv, VALUE self)
{
VALUE nFig;
VALUE nCur = INT2NUM(VpGetPrecLimit());
if(rb_scan_args(argc,argv,"01",&nFig)==1) {
int nf;
if(nFig==Qnil) return nCur;
Check_Type(nFig, T_FIXNUM);
nf = FIX2INT(nFig);
if(nf<0) {
rb_raise(rb_eArgError, "argument must be positive");
}
VpSetPrecLimit(nf);
}
return nCur;
}