m||e.e<-m))throw Error(u+n)}else e.s=0,e.e=0,e.d=[0];return e}function T(e,t,n){var r,o,a,i,s,c,f,g,h=e.d;for(i=1,a=h[0];a>=10;a/=10)i++;if((r=t-i)<0)r+=7,o=t,f=h[g=0];else{if((g=Math.ceil((r+1)/7))>=(a=h.length))return e;for(i=1,f=a=h[g];a>=10;a/=10)i++;r%=7,o=r-7+i}if(void 0!==n&&(s=f/(a=p(10,i-o-1))%10|0,c=t<0||void 0!==h[g+1]||f%a,c=n<4?(s||c)&&(0==n||n==(e.s<0?3:2)):s>5||5==s&&(4==n||c||6==n&&(r>0?o>0?f/p(10,i-o):0:h[g-1])%10&1||n==(e.s<0?8:7))),t<1||!h[0])return c?(a=S(e),h.length=1,t=t-a-1,h[0]=p(10,(7-t%7)%7),e.e=d(-t/7)||0):(h.length=1,h[0]=e.e=e.s=0),e;if(0==r?(h.length=g,a=1,g--):(h.length=g+1,a=p(10,7-r),h[g]=o>0?(f/p(10,i-o)%p(10,o)|0)*a:0),c)for(;;){if(0==g){1e7==(h[0]+=a)&&(h[0]=1,++e.e);break}if(h[g]+=a,1e7!=h[g])break;h[g--]=0,a=1}for(r=h.length;0===h[--r];)h.pop();if(l&&(e.e>m||e.e<-m))throw Error(u+S(e));return e}function k(e,t){var n,r,o,a,i,s,c,u,d,p,f=e.constructor,m=f.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new f(e),l?T(t,m):t;if(c=e.d,p=t.d,r=t.e,u=e.e,c=c.slice(),i=u-r){for((d=i<0)?(n=c,i=-i,s=p.length):(n=p,r=u,s=c.length),i>(o=Math.max(Math.ceil(m/7),s)+2)&&(i=o,n.length=1),n.reverse(),o=i;o--;)n.push(0);n.reverse()}else{for((d=(o=c.length)<(s=p.length))&&(s=o),o=0;o0;--o)c[s++]=0;for(o=p.length;o>i;){if(c[--o]0?a=a.charAt(0)+"."+a.slice(1)+x(r):i>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(o<0?"e":"e+")+o):o<0?(a="0."+x(-o-1)+a,n&&(r=n-i)>0&&(a+=x(r))):o>=i?(a+=x(o+1-i),n&&(r=n-o-1)>0&&(a=a+"."+x(r))):((r=o+1)0&&(o+1===i&&(a+="."),a+=x(r))),e.s<0?"-"+a:a}function I(e,t){if(e.length>t)return e.length=t,!0}function R(e){if(!e||"object"!=typeof e)throw Error(s+"Object expected");var t,n,r,o=["precision",1,1e9,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t=o[t+1]&&r<=o[t+2])this[n]=r;else throw Error(c+n+": "+r)}if(void 0!==(r=e[n="LN10"])){if(r==Math.LN10)this[n]=new this(r);else throw Error(c+n+": "+r)}return this}(i=function e(t){var n,r,o;function a(e){if(!(this instanceof a))return new a(e);if(this.constructor=a,e instanceof a){this.s=e.s,this.e=e.e,this.d=(e=e.d)?e.slice():e;return}if("number"==typeof e){if(0*e!=0)throw Error(c+e);if(e>0)this.s=1;else if(e<0)e=-e,this.s=-1;else{this.s=0,this.e=0,this.d=[0];return}if(e===~~e&&e<1e7){this.e=0,this.d=[e];return}return C(this,e.toString())}if("string"!=typeof e)throw Error(c+e);if(45===e.charCodeAt(0)?(e=e.slice(1),this.s=-1):this.s=1,f.test(e))C(this,e);else throw Error(c+e)}if(a.prototype=g,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=e,a.config=a.set=R,void 0===t&&(t={}),t)for(n=0,o=["precision","rounding","toExpNeg","toExpPos","LN10"];n