MathContext.prototype.getDigits=getDigits;MathContext.prototype.getForm=getForm;MathContext.prototype.getLostDigits=getLostDigits;MathContext.prototype.getRoundingMode=getRoundingMode;MathContext.prototype.toString=toString;MathContext.prototype.isValidRound=isValidRound;MathContext.PLAIN=MathContext.prototype.PLAIN=0;MathContext.SCIENTIFIC=MathContext.prototype.SCIENTIFIC=1;MathContext.ENGINEERING=MathContext.prototype.ENGINEERING=2;MathContext.ROUND_CEILING=MathContext.prototype.ROUND_CEILING=2;
MathContext.ROUND_DOWN=MathContext.prototype.ROUND_DOWN=1;MathContext.ROUND_FLOOR=MathContext.prototype.ROUND_FLOOR=3;MathContext.ROUND_HALF_DOWN=MathContext.prototype.ROUND_HALF_DOWN=5;MathContext.ROUND_HALF_EVEN=MathContext.prototype.ROUND_HALF_EVEN=6;MathContext.ROUND_HALF_UP=MathContext.prototype.ROUND_HALF_UP=4;MathContext.ROUND_UNNECESSARY=MathContext.prototype.ROUND_UNNECESSARY=7;MathContext.ROUND_UP=MathContext.prototype.ROUND_UP=0;MathContext.prototype.DEFAULT_FORM=MathContext.prototype.SCIENTIFIC;
MathContext.prototype.DEFAULT_DIGITS=9;MathContext.prototype.DEFAULT_LOSTDIGITS=!1;MathContext.prototype.DEFAULT_ROUNDINGMODE=MathContext.prototype.ROUND_HALF_UP;MathContext.prototype.MIN_DIGITS=0;MathContext.prototype.MAX_DIGITS=999999999;
MathContext.prototype.ROUNDS=[MathContext.prototype.ROUND_HALF_UP,MathContext.prototype.ROUND_UNNECESSARY,MathContext.prototype.ROUND_CEILING,MathContext.prototype.ROUND_DOWN,MathContext.prototype.ROUND_FLOOR,MathContext.prototype.ROUND_HALF_DOWN,MathContext.prototype.ROUND_HALF_EVEN,MathContext.prototype.ROUND_UP];MathContext.prototype.ROUNDWORDS="ROUND_HALF_UP ROUND_UNNECESSARY ROUND_CEILING ROUND_DOWN ROUND_FLOOR ROUND_HALF_DOWN ROUND_HALF_EVEN ROUND_UP".split(" ");
MathContext.prototype.DEFAULT=new MathContext(MathContext.prototype.DEFAULT_DIGITS,MathContext.prototype.DEFAULT_FORM,MathContext.prototype.DEFAULT_LOSTDIGITS,MathContext.prototype.DEFAULT_ROUNDINGMODE);
function MathContext(){this.form=this.digits=0;this.lostDigits=!1;this.roundingMode=0;var a=this.DEFAULT_FORM,b=this.DEFAULT_LOSTDIGITS,c=this.DEFAULT_ROUNDINGMODE;if(4==MathContext.arguments.length)a=MathContext.arguments[1],b=MathContext.arguments[2],c=MathContext.arguments[3];else if(3==MathContext.arguments.length)a=MathContext.arguments[1],b=MathContext.arguments[2];else if(2==MathContext.arguments.length)a=MathContext.arguments[1];else if(1!=MathContext.arguments.length)throw"MathContext(): "+
MathContext.arguments.length+" arguments given; expected 1 to 4";var d=MathContext.arguments[0];if(d!=this.DEFAULT_DIGITS){if(d<this.MIN_DIGITS)throw"MathContext(): Digits too small: "+d;if(d>this.MAX_DIGITS)throw"MathContext(): Digits too large: "+d;}if(a!=this.SCIENTIFIC&&a!=this.ENGINEERING&&a!=this.PLAIN)throw"MathContext() Bad form value: "+a;if(!this.isValidRound(c))throw"MathContext(): Bad roundingMode value: "+c;this.digits=d;this.form=a;this.lostDigits=b;this.roundingMode=c}
function getDigits(){return this.digits}function getForm(){return this.form}function getLostDigits(){return this.lostDigits}function getRoundingMode(){return this.roundingMode}
function toString(){var a=null,b=0,c=null,a=this.form==this.SCIENTIFIC?"SCIENTIFIC":this.form==this.ENGINEERING?"ENGINEERING":"PLAIN",d=this.ROUNDS.length,b=0;a:for(;0<d;d--,b++)if(this.roundingMode==this.ROUNDS[b]){c=this.ROUNDWORDS[b];break a}return"digits="+this.digits+" form="+a+" lostDigits="+(this.lostDigits?"1":"0")+" roundingMode="+c}function isValidRound(a){var b=0,c=this.ROUNDS.length,b=0;for(;0<c;c--,b++)if(a==this.ROUNDS[b])return!0;return!1};
