Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bignumber.js

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bignumber.js - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

4

bignumber.min.js

@@ -1,3 +0,3 @@

/* bignumber.js v3.0.1 https://github.com/MikeMcl/bignumber.js/LICENCE */
!function(e){"use strict";function n(e){function a(e,n){var t,r,i,o,u,s,l=this;if(!(l instanceof a))return z&&I(26,"constructor call without new",e),new a(e,n);if(null!=n&&V(n,2,64,C,"base")){if(n=0|n,s=e+"",10==n)return l=new a(e instanceof a?e:s),L(l,B+l.e+1,P);if((o="number"==typeof e)&&0*e!=0||!new RegExp("^-?"+(t="["+N.slice(0,n)+"]+")+"(?:\\."+t+")?$",37>n?"i":"").test(s))return h(l,s,o,n);o?(l.s=0>1/e?(s=s.slice(1),-1):1,z&&s.replace(/^0\.0*|\./,"").length>15&&I(C,v,e),o=!1):l.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1,s=E(s,10,n,l.s)}else{if(e instanceof a)return l.s=e.s,l.e=e.e,l.c=(e=e.c)?e.slice():e,void(C=0);if((o="number"==typeof e)&&0*e==0){if(l.s=0>1/e?(e=-e,-1):1,e===~~e){for(r=0,i=e;i>=10;i/=10,r++);return l.e=r,l.c=[e],void(C=0)}s=e+""}else{if(!g.test(s=e+""))return h(l,s,o);l.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1}}for((r=s.indexOf("."))>-1&&(s=s.replace(".","")),(i=s.search(/e/i))>0?(0>r&&(r=i),r+=+s.slice(i+1),s=s.substring(0,i)):0>r&&(r=s.length),i=0;48===s.charCodeAt(i);i++);for(u=s.length;48===s.charCodeAt(--u););if(s=s.slice(i,u+1))if(u=s.length,o&&z&&u>15&&(e>O||e!==d(e))&&I(C,v,l.s*e),r=r-i-1,r>G)l.c=l.e=null;else if($>r)l.c=[l.e=0];else{if(l.e=r,l.c=[],i=(r+1)%y,0>r&&(i+=y),u>i){for(i&&l.c.push(+s.slice(0,i)),u-=y;u>i;)l.c.push(+s.slice(i,i+=y));s=s.slice(i),i=y-s.length}else i-=u;for(;i--;s+="0");l.c.push(+s)}else l.c=[l.e=0];C=0}function E(e,n,t,i){var o,u,l,c,h,g,p,d=e.indexOf("."),m=B,w=P;for(37>t&&(e=e.toLowerCase()),d>=0&&(l=W,W=0,e=e.replace(".",""),p=new a(t),h=p.pow(e.length-d),W=l,p.c=s(f(r(h.c),h.e),10,n),p.e=p.c.length),g=s(e,t,n),u=l=g.length;0==g[--l];g.pop());if(!g[0])return"0";if(0>d?--u:(h.c=g,h.e=u,h.s=i,h=U(h,p,m,w,n),g=h.c,c=h.r,u=h.e),o=u+m+1,d=g[o],l=n/2,c=c||0>o||null!=g[o+1],c=4>w?(null!=d||c)&&(0==w||w==(h.s<0?3:2)):d>l||d==l&&(4==w||c||6==w&&1&g[o-1]||w==(h.s<0?8:7)),1>o||!g[0])e=c?f("1",-m):"0";else{if(g.length=o,c)for(--n;++g[--o]>n;)g[o]=0,o||(++u,g.unshift(1));for(l=g.length;!g[--l];);for(d=0,e="";l>=d;e+=N.charAt(g[d++]));e=f(e,u)}return e}function D(e,n,t,i){var o,u,s,c,h;if(t=null!=t&&V(t,0,8,i,w)?0|t:P,!e.c)return e.toString();if(o=e.c[0],s=e.e,null==n)h=r(e.c),h=19==i||24==i&&q>=s?l(h,s):f(h,s);else if(e=L(new a(e),n,t),u=e.e,h=r(e.c),c=h.length,19==i||24==i&&(u>=n||q>=u)){for(;n>c;h+="0",c++);h=l(h,u)}else if(n-=s,h=f(h,u),u+1>c){if(--n>0)for(h+=".";n--;h+="0");}else if(n+=u-c,n>0)for(u+1==c&&(h+=".");n--;h+="0");return e.s<0&&o?"-"+h:h}function F(e,n){var t,r,i=0;for(u(e[0])&&(e=e[0]),t=new a(e[0]);++i<e.length;){if(r=new a(e[i]),!r.s){t=r;break}n.call(t,r)&&(t=r)}return t}function _(e,n,t,r,i){return(n>e||e>t||e!=c(e))&&I(r,(i||"decimal places")+(n>e||e>t?" out of range":" not an integer"),e),!0}function x(e,n,t){for(var r=1,i=n.length;!n[--i];n.pop());for(i=n[0];i>=10;i/=10,r++);return(t=r+t*y-1)>G?e.c=e.e=null:$>t?e.c=[e.e=0]:(e.e=t,e.c=n),e}function I(e,n,t){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][e]+"() "+n+": "+t);throw r.name="BigNumber Error",C=0,r}function L(e,n,t,r){var i,o,u,s,l,f,c,a=e.c,h=R;if(a){e:{for(i=1,s=a[0];s>=10;s/=10,i++);if(o=n-i,0>o)o+=y,u=n,l=a[f=0],c=l/h[i-u-1]%10|0;else if(f=p((o+1)/y),f>=a.length){if(!r)break e;for(;a.length<=f;a.push(0));l=c=0,i=1,o%=y,u=o-y+1}else{for(l=s=a[f],i=1;s>=10;s/=10,i++);o%=y,u=o-y+i,c=0>u?0:l/h[i-u-1]%10|0}if(r=r||0>n||null!=a[f+1]||(0>u?l:l%h[i-u-1]),r=4>t?(c||r)&&(0==t||t==(e.s<0?3:2)):c>5||5==c&&(4==t||r||6==t&&(o>0?u>0?l/h[i-u]:0:a[f-1])%10&1||t==(e.s<0?8:7)),1>n||!a[0])return a.length=0,r?(n-=e.e+1,a[0]=h[(y-n%y)%y],e.e=-n||0):a[0]=e.e=0,e;if(0==o?(a.length=f,s=1,f--):(a.length=f+1,s=h[y-o],a[f]=u>0?d(l/h[i-u]%h[u])*s:0),r)for(;;){if(0==f){for(o=1,u=a[0];u>=10;u/=10,o++);for(u=a[0]+=s,s=1;u>=10;u/=10,s++);o!=s&&(e.e++,a[0]==b&&(a[0]=1));break}if(a[f]+=s,a[f]!=b)break;a[f--]=0,s=1}for(o=a.length;0===a[--o];a.pop());}e.e>G?e.c=e.e=null:e.e<$&&(e.c=[e.e=0])}return e}var U,C=0,M=a.prototype,T=new a(1),B=20,P=4,q=-7,k=21,$=-1e7,G=1e7,z=!0,V=_,j=!1,H=1,W=0,J={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0};return a.another=n,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.EUCLID=9,a.config=a.set=function(){var e,n,t=0,r={},i=arguments,s=i[0],l=s&&"object"==typeof s?function(){return s.hasOwnProperty(n)?null!=(e=s[n]):void 0}:function(){return i.length>t?null!=(e=i[t++]):void 0};return l(n="DECIMAL_PLACES")&&V(e,0,A,2,n)&&(B=0|e),r[n]=B,l(n="ROUNDING_MODE")&&V(e,0,8,2,n)&&(P=0|e),r[n]=P,l(n="EXPONENTIAL_AT")&&(u(e)?V(e[0],-A,0,2,n)&&V(e[1],0,A,2,n)&&(q=0|e[0],k=0|e[1]):V(e,-A,A,2,n)&&(q=-(k=0|(0>e?-e:e)))),r[n]=[q,k],l(n="RANGE")&&(u(e)?V(e[0],-A,-1,2,n)&&V(e[1],1,A,2,n)&&($=0|e[0],G=0|e[1]):V(e,-A,A,2,n)&&(0|e?$=-(G=0|(0>e?-e:e)):z&&I(2,n+" cannot be zero",e))),r[n]=[$,G],l(n="ERRORS")&&(e===!!e||1===e||0===e?(C=0,V=(z=!!e)?_:o):z&&I(2,n+m,e)),r[n]=z,l(n="CRYPTO")&&(e===!0||e===!1||1===e||0===e?e?(e="undefined"==typeof crypto,!e&&crypto&&(crypto.getRandomValues||crypto.randomBytes)?j=!0:z?I(2,"crypto unavailable",e?void 0:crypto):j=!1):j=!1:z&&I(2,n+m,e)),r[n]=j,l(n="MODULO_MODE")&&V(e,0,9,2,n)&&(H=0|e),r[n]=H,l(n="POW_PRECISION")&&V(e,0,A,2,n)&&(W=0|e),r[n]=W,l(n="FORMAT")&&("object"==typeof e?J=e:z&&I(2,n+" not an object",e)),r[n]=J,r},a.max=function(){return F(arguments,M.lt)},a.min=function(){return F(arguments,M.gt)},a.random=function(){var e=9007199254740992,n=Math.random()*e&2097151?function(){return d(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var t,r,i,o,u,s=0,l=[],f=new a(T);if(e=null!=e&&V(e,0,A,14)?0|e:B,o=p(e/y),j)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));o>s;)u=131072*t[s]+(t[s+1]>>>11),u>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(l.push(u%1e14),s+=2);s=o/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(o*=7);o>s;)u=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6],u>=9e15?crypto.randomBytes(7).copy(t,s):(l.push(u%1e14),s+=7);s=o/7}else j=!1,z&&I(14,"crypto unavailable",crypto);if(!j)for(;o>s;)u=n(),9e15>u&&(l[s++]=u%1e14);for(o=l[--s],e%=y,o&&e&&(u=R[y-e],l[s]=d(o/u)*u);0===l[s];l.pop(),s--);if(0>s)l=[i=0];else{for(i=-1;0===l[0];l.shift(),i-=y);for(s=1,u=l[0];u>=10;u/=10,s++);y>s&&(i-=y-s)}return f.e=i,f.c=l,f}}(),U=function(){function e(e,n,t){var r,i,o,u,s=0,l=e.length,f=n%S,c=n/S|0;for(e=e.slice();l--;)o=e[l]%S,u=e[l]/S|0,r=c*o+u*f,i=f*o+r%S*S+s,s=(i/t|0)+(r/S|0)+c*u,e[l]=i%t;return s&&e.unshift(s),e}function n(e,n,t,r){var i,o;if(t!=r)o=t>r?1:-1;else for(i=o=0;t>i;i++)if(e[i]!=n[i]){o=e[i]>n[i]?1:-1;break}return o}function r(e,n,t,r){for(var i=0;t--;)e[t]-=i,i=e[t]<n[t]?1:0,e[t]=i*r+e[t]-n[t];for(;!e[0]&&e.length>1;e.shift());}return function(i,o,u,s,l){var f,c,h,g,p,m,w,v,N,O,R,S,A,E,D,F,_,x=i.s==o.s?1:-1,I=i.c,U=o.c;if(!(I&&I[0]&&U&&U[0]))return new a(i.s&&o.s&&(I?!U||I[0]!=U[0]:U)?I&&0==I[0]||!U?0*x:x/0:NaN);for(v=new a(x),N=v.c=[],c=i.e-o.e,x=u+c+1,l||(l=b,c=t(i.e/y)-t(o.e/y),x=x/y|0),h=0;U[h]==(I[h]||0);h++);if(U[h]>(I[h]||0)&&c--,0>x)N.push(1),g=!0;else{for(E=I.length,F=U.length,h=0,x+=2,p=d(l/(U[0]+1)),p>1&&(U=e(U,p,l),I=e(I,p,l),F=U.length,E=I.length),A=F,O=I.slice(0,F),R=O.length;F>R;O[R++]=0);_=U.slice(),_.unshift(0),D=U[0],U[1]>=l/2&&D++;do{if(p=0,f=n(U,O,F,R),0>f){if(S=O[0],F!=R&&(S=S*l+(O[1]||0)),p=d(S/D),p>1)for(p>=l&&(p=l-1),m=e(U,p,l),w=m.length,R=O.length;1==n(m,O,w,R);)p--,r(m,w>F?_:U,w,l),w=m.length,f=1;else 0==p&&(f=p=1),m=U.slice(),w=m.length;if(R>w&&m.unshift(0),r(O,m,R,l),R=O.length,-1==f)for(;n(U,O,F,R)<1;)p++,r(O,R>F?_:U,R,l),R=O.length}else 0===f&&(p++,O=[0]);N[h++]=p,O[0]?O[R++]=I[A]||0:(O=[I[A]],R=1)}while((A++<E||null!=O[0])&&x--);g=null!=O[0],N[0]||N.shift()}if(l==b){for(h=1,x=N[0];x>=10;x/=10,h++);L(v,u+(v.e=h+c*y-1)+1,s,g)}else v.e=c,v.r=+g;return v}}(),h=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,n=/^([^.]+)\.$/,t=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,u,s,l){var f,c=s?u:u.replace(i,"");if(r.test(c))o.s=isNaN(c)?null:0>c?-1:1;else{if(!s&&(c=c.replace(e,function(e,n,t){return f="x"==(t=t.toLowerCase())?16:"b"==t?2:8,l&&l!=f?e:n}),l&&(f=l,c=c.replace(n,"$1").replace(t,"0.$1")),u!=c))return new a(c,f);z&&I(C,"not a"+(l?" base "+l:"")+" number",u),o.s=null}o.c=o.e=null,C=0}}(),M.absoluteValue=M.abs=function(){var e=new a(this);return e.s<0&&(e.s=1),e},M.ceil=function(){return L(new a(this),this.e+1,2)},M.comparedTo=M.cmp=function(e,n){return C=1,i(this,new a(e,n))},M.decimalPlaces=M.dp=function(){var e,n,r=this.c;if(!r)return null;if(e=((n=r.length-1)-t(this.e/y))*y,n=r[n])for(;n%10==0;n/=10,e--);return 0>e&&(e=0),e},M.dividedBy=M.div=function(e,n){return C=3,U(this,new a(e,n),B,P)},M.dividedToIntegerBy=M.divToInt=function(e,n){return C=4,U(this,new a(e,n),0,1)},M.equals=M.eq=function(e,n){return C=5,0===i(this,new a(e,n))},M.floor=function(){return L(new a(this),this.e+1,3)},M.greaterThan=M.gt=function(e,n){return C=6,i(this,new a(e,n))>0},M.greaterThanOrEqualTo=M.gte=function(e,n){return C=7,1===(n=i(this,new a(e,n)))||0===n},M.isFinite=function(){return!!this.c},M.isInteger=M.isInt=function(){return!!this.c&&t(this.e/y)>this.c.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.lessThan=M.lt=function(e,n){return C=8,i(this,new a(e,n))<0},M.lessThanOrEqualTo=M.lte=function(e,n){return C=9,-1===(n=i(this,new a(e,n)))||0===n},M.minus=M.sub=function(e,n){var r,i,o,u,s=this,l=s.s;if(C=10,e=new a(e,n),n=e.s,!l||!n)return new a(NaN);if(l!=n)return e.s=-n,s.plus(e);var f=s.e/y,c=e.e/y,h=s.c,g=e.c;if(!f||!c){if(!h||!g)return h?(e.s=-n,e):new a(g?s:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-n,e):new a(h[0]?s:3==P?-0:0)}if(f=t(f),c=t(c),h=h.slice(),l=f-c){for((u=0>l)?(l=-l,o=h):(c=f,o=g),o.reverse(),n=l;n--;o.push(0));o.reverse()}else for(i=(u=(l=h.length)<(n=g.length))?l:n,l=n=0;i>n;n++)if(h[n]!=g[n]){u=h[n]<g[n];break}if(u&&(o=h,h=g,g=o,e.s=-e.s),n=(i=g.length)-(r=h.length),n>0)for(;n--;h[r++]=0);for(n=b-1;i>l;){if(h[--i]<g[i]){for(r=i;r&&!h[--r];h[r]=n);--h[r],h[i]+=b}h[i]-=g[i]}for(;0==h[0];h.shift(),--c);return h[0]?x(e,h,c):(e.s=3==P?-1:1,e.c=[e.e=0],e)},M.modulo=M.mod=function(e,n){var t,r,i=this;return C=11,e=new a(e,n),!i.c||!e.s||e.c&&!e.c[0]?new a(NaN):!e.c||i.c&&!i.c[0]?new a(i):(9==H?(r=e.s,e.s=1,t=U(i,e,0,3),e.s=r,t.s*=r):t=U(i,e,0,H),i.minus(t.times(e)))},M.negated=M.neg=function(){var e=new a(this);return e.s=-e.s||null,e},M.plus=M.add=function(e,n){var r,i=this,o=i.s;if(C=12,e=new a(e,n),n=e.s,!o||!n)return new a(NaN);if(o!=n)return e.s=-n,i.minus(e);var u=i.e/y,s=e.e/y,l=i.c,f=e.c;if(!u||!s){if(!l||!f)return new a(o/0);if(!l[0]||!f[0])return f[0]?e:new a(l[0]?i:0*o)}if(u=t(u),s=t(s),l=l.slice(),o=u-s){for(o>0?(s=u,r=f):(o=-o,r=l),r.reverse();o--;r.push(0));r.reverse()}for(o=l.length,n=f.length,0>o-n&&(r=f,f=l,l=r,n=o),o=0;n;)o=(l[--n]=l[n]+f[n]+o)/b|0,l[n]=b===l[n]?0:l[n]%b;return o&&(l.unshift(o),++s),x(e,l,s)},M.precision=M.sd=function(e){var n,t,r=this,i=r.c;if(null!=e&&e!==!!e&&1!==e&&0!==e&&(z&&I(13,"argument"+m,e),e!=!!e&&(e=null)),!i)return null;if(t=i.length-1,n=t*y+1,t=i[t]){for(;t%10==0;t/=10,n--);for(t=i[0];t>=10;t/=10,n++);}return e&&r.e+1>n&&(n=r.e+1),n},M.round=function(e,n){var t=new a(this);return(null==e||V(e,0,A,15))&&L(t,~~e+this.e+1,null!=n&&V(n,0,8,15,w)?0|n:P),t},M.shift=function(e){var n=this;return V(e,-O,O,16,"argument")?n.times("1e"+c(e)):new a(n.c&&n.c[0]&&(-O>e||e>O)?n.s*(0>e?0:1/0):n)},M.squareRoot=M.sqrt=function(){var e,n,i,o,u,s=this,l=s.c,f=s.s,c=s.e,h=B+4,g=new a("0.5");if(1!==f||!l||!l[0])return new a(!f||0>f&&(!l||l[0])?NaN:l?s:1/0);if(f=Math.sqrt(+s),0==f||f==1/0?(n=r(l),(n.length+c)%2==0&&(n+="0"),f=Math.sqrt(n),c=t((c+1)/2)-(0>c||c%2),f==1/0?n="1e"+c:(n=f.toExponential(),n=n.slice(0,n.indexOf("e")+1)+c),i=new a(n)):i=new a(f+""),i.c[0])for(c=i.e,f=c+h,3>f&&(f=0);;)if(u=i,i=g.times(u.plus(U(s,u,h,1))),r(u.c).slice(0,f)===(n=r(i.c)).slice(0,f)){if(i.e<c&&--f,n=n.slice(f-3,f+1),"9999"!=n&&(o||"4999"!=n)){(!+n||!+n.slice(1)&&"5"==n.charAt(0))&&(L(i,i.e+B+2,1),e=!i.times(i).eq(s));break}if(!o&&(L(u,u.e+B+2,0),u.times(u).eq(s))){i=u;break}h+=4,f+=4,o=1}return L(i,i.e+B+1,P,e)},M.times=M.mul=function(e,n){var r,i,o,u,s,l,f,c,h,g,p,d,m,w,v,N=this,O=N.c,R=(C=17,e=new a(e,n)).c;if(!(O&&R&&O[0]&&R[0]))return!N.s||!e.s||O&&!O[0]&&!R||R&&!R[0]&&!O?e.c=e.e=e.s=null:(e.s*=N.s,O&&R?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=t(N.e/y)+t(e.e/y),e.s*=N.s,f=O.length,g=R.length,g>f&&(m=O,O=R,R=m,o=f,f=g,g=o),o=f+g,m=[];o--;m.push(0));for(w=b,v=S,o=g;--o>=0;){for(r=0,p=R[o]%v,d=R[o]/v|0,s=f,u=o+s;u>o;)c=O[--s]%v,h=O[s]/v|0,l=d*c+h*p,c=p*c+l%v*v+m[u]+r,r=(c/w|0)+(l/v|0)+d*h,m[u--]=c%w;m[u]=r}return r?++i:m.shift(),x(e,m,i)},M.toDigits=function(e,n){var t=new a(this);return e=null!=e&&V(e,1,A,18,"precision")?0|e:null,n=null!=n&&V(n,0,8,18,w)?0|n:P,e?L(t,e,n):t},M.toExponential=function(e,n){return D(this,null!=e&&V(e,0,A,19)?~~e+1:null,n,19)},M.toFixed=function(e,n){return D(this,null!=e&&V(e,0,A,20)?~~e+this.e+1:null,n,20)},M.toFormat=function(e,n){var t=D(this,null!=e&&V(e,0,A,21)?~~e+this.e+1:null,n,21);if(this.c){var r,i=t.split("."),o=+J.groupSize,u=+J.secondaryGroupSize,s=J.groupSeparator,l=i[0],f=i[1],c=this.s<0,a=c?l.slice(1):l,h=a.length;if(u&&(r=o,o=u,u=r,h-=r),o>0&&h>0){for(r=h%o||o,l=a.substr(0,r);h>r;r+=o)l+=s+a.substr(r,o);u>0&&(l+=s+a.slice(r)),c&&(l="-"+l)}t=f?l+J.decimalSeparator+((u=+J.fractionGroupSize)?f.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+J.fractionGroupSeparator):f):l}return t},M.toFraction=function(e){var n,t,i,o,u,s,l,f,c,h=z,g=this,p=g.c,d=new a(T),m=t=new a(T),w=l=new a(T);if(null!=e&&(z=!1,s=new a(e),z=h,(!(h=s.isInt())||s.lt(T))&&(z&&I(22,"max denominator "+(h?"out of range":"not an integer"),e),e=!h&&s.c&&L(s,s.e+1,1).gte(T)?s:null)),!p)return g.toString();for(c=r(p),o=d.e=c.length-g.e-1,d.c[0]=R[(u=o%y)<0?y+u:u],e=!e||s.cmp(d)>0?o>0?d:m:s,u=G,G=1/0,s=new a(c),l.c[0]=0;f=U(s,d,0,1),i=t.plus(f.times(w)),1!=i.cmp(e);)t=w,w=i,m=l.plus(f.times(i=m)),l=i,d=s.minus(f.times(i=d)),s=i;return i=U(e.minus(t),w,0,1),l=l.plus(i.times(m)),t=t.plus(i.times(w)),l.s=m.s=g.s,o*=2,n=U(m,w,o,P).minus(g).abs().cmp(U(l,t,o,P).minus(g).abs())<1?[m.toString(),w.toString()]:[l.toString(),t.toString()],G=u,n},M.toNumber=function(){return+this},M.toPower=M.pow=function(e,n){var t,r,i,o=d(0>e?-e:+e),u=this;if(null!=n&&(C=23,n=new a(n)),!V(e,-O,O,23,"exponent")&&(!isFinite(e)||o>O&&(e/=0)||parseFloat(e)!=e&&!(e=NaN))||0==e)return t=Math.pow(+u,e),new a(n?t%n:t);for(n?e>1&&u.gt(T)&&u.isInt()&&n.gt(T)&&n.isInt()?u=u.mod(n):(i=n,n=null):W&&(t=p(W/y+2)),r=new a(T);;){if(o%2){if(r=r.times(u),!r.c)break;t?r.c.length>t&&(r.c.length=t):n&&(r=r.mod(n))}if(o=d(o/2),!o)break;u=u.times(u),t?u.c&&u.c.length>t&&(u.c.length=t):n&&(u=u.mod(n))}return n?r:(0>e&&(r=T.div(r)),i?r.mod(i):t?L(r,W,P):r)},M.toPrecision=function(e,n){return D(this,null!=e&&V(e,1,A,24,"precision")?0|e:null,n,24)},M.toString=function(e){var n,t=this,i=t.s,o=t.e;return null===o?i?(n="Infinity",0>i&&(n="-"+n)):n="NaN":(n=r(t.c),n=null!=e&&V(e,2,64,25,"base")?E(f(n,o),0|e,10,i):q>=o||o>=k?l(n,o):f(n,o),0>i&&t.c[0]&&(n="-"+n)),n},M.truncated=M.trunc=function(){return L(new a(this),this.e+1,1)},M.valueOf=M.toJSON=function(){var e,n=this,t=n.e;return null===t?n.toString():(e=r(n.c),e=q>=t||t>=k?l(e,t):f(e,t),n.s<0?"-"+e:e)},null!=e&&a.config(e),a}function t(e){var n=0|e;return e>0||e===n?n:n-1}function r(e){for(var n,t,r=1,i=e.length,o=e[0]+"";i>r;){for(n=e[r++]+"",t=y-n.length;t--;n="0"+n);o+=n}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function i(e,n){var t,r,i=e.c,o=n.c,u=e.s,s=n.s,l=e.e,f=n.e;if(!u||!s)return null;if(t=i&&!i[0],r=o&&!o[0],t||r)return t?r?0:-s:u;if(u!=s)return u;if(t=0>u,r=l==f,!i||!o)return r?0:!i^t?1:-1;if(!r)return l>f^t?1:-1;for(s=(l=i.length)<(f=o.length)?l:f,u=0;s>u;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return l==f?0:l>f^t?1:-1}function o(e,n,t){return(e=c(e))>=n&&t>=e}function u(e){return"[object Array]"==Object.prototype.toString.call(e)}function s(e,n,t){for(var r,i,o=[0],u=0,s=e.length;s>u;){for(i=o.length;i--;o[i]*=n);for(o[r=0]+=N.indexOf(e.charAt(u++));r<o.length;r++)o[r]>t-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/t|0,o[r]%=t)}return o.reverse()}function l(e,n){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>n?"e":"e+")+n}function f(e,n){var t,r;if(0>n){for(r="0.";++n;r+="0");e=r+e}else if(t=e.length,++n>t){for(r="0",n-=t;--n;r+="0");e+=r}else t>n&&(e=e.slice(0,n)+"."+e.slice(n));return e}function c(e){return e=parseFloat(e),0>e?p(e):d(e)}var a,h,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,p=Math.ceil,d=Math.floor,m=" not a boolean or binary digit",w="rounding mode",v="number type has more than 15 significant digits",N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",b=1e14,y=14,O=9007199254740991,R=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],S=1e7,A=1e9;a=n(),a["default"]=a.BigNumber=a,"function"==typeof define&&define.amd?define(function(){return a}):"undefined"!=typeof module&&module.exports?module.exports=a:(e||(e="undefined"!=typeof self?self:Function("return this")()),e.BigNumber=a)}(this);
/* bignumber.js v3.1.0 https://github.com/MikeMcl/bignumber.js/LICENCE */
!function(e){"use strict";function n(e){function h(e,n){var t,r,i,o,u,s,f=this;if(!(f instanceof h))return V&&I(26,"constructor call without new",e),new h(e,n);if(null!=n&&j(n,2,64,C,"base")){if(n=0|n,s=e+"",10==n)return f=new h(e instanceof h?e:s),L(f,P+f.e+1,q);if((o="number"==typeof e)&&0*e!=0||!new RegExp("^-?"+(t="["+N.slice(0,n)+"]+")+"(?:\\."+t+")?$",37>n?"i":"").test(s))return B(f,s,o,n);o?(f.s=0>1/e?(s=s.slice(1),-1):1,V&&s.replace(/^0\.0*|\./,"").length>15&&I(C,v,e),o=!1):f.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1,s=E(s,10,n,f.s)}else{if(e instanceof h)return f.s=e.s,f.e=e.e,f.c=(e=e.c)?e.slice():e,void(C=0);if((o="number"==typeof e)&&0*e==0){if(f.s=0>1/e?(e=-e,-1):1,e===~~e){for(r=0,i=e;i>=10;i/=10,r++);return f.e=r,f.c=[e],void(C=0)}s=e+""}else{if(!g.test(s=e+""))return B(f,s,o);f.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1}}for((r=s.indexOf("."))>-1&&(s=s.replace(".","")),(i=s.search(/e/i))>0?(0>r&&(r=i),r+=+s.slice(i+1),s=s.substring(0,i)):0>r&&(r=s.length),i=0;48===s.charCodeAt(i);i++);for(u=s.length;48===s.charCodeAt(--u););if(s=s.slice(i,u+1))if(u=s.length,o&&V&&u>15&&(e>O||e!==d(e))&&I(C,v,f.s*e),r=r-i-1,r>z)f.c=f.e=null;else if(G>r)f.c=[f.e=0];else{if(f.e=r,f.c=[],i=(r+1)%y,0>r&&(i+=y),u>i){for(i&&f.c.push(+s.slice(0,i)),u-=y;u>i;)f.c.push(+s.slice(i,i+=y));s=s.slice(i),i=y-s.length}else i-=u;for(;i--;s+="0");f.c.push(+s)}else f.c=[f.e=0];C=0}function E(e,n,t,i){var o,u,s,l,a,g,p,d=e.indexOf("."),m=P,w=q;for(37>t&&(e=e.toLowerCase()),d>=0&&(s=J,J=0,e=e.replace(".",""),p=new h(t),a=p.pow(e.length-d),J=s,p.c=f(c(r(a.c),a.e),10,n),p.e=p.c.length),g=f(e,t,n),u=s=g.length;0==g[--s];g.pop());if(!g[0])return"0";if(0>d?--u:(a.c=g,a.e=u,a.s=i,a=U(a,p,m,w,n),g=a.c,l=a.r,u=a.e),o=u+m+1,d=g[o],s=n/2,l=l||0>o||null!=g[o+1],l=4>w?(null!=d||l)&&(0==w||w==(a.s<0?3:2)):d>s||d==s&&(4==w||l||6==w&&1&g[o-1]||w==(a.s<0?8:7)),1>o||!g[0])e=l?c("1",-m):"0";else{if(g.length=o,l)for(--n;++g[--o]>n;)g[o]=0,o||(++u,g.unshift(1));for(s=g.length;!g[--s];);for(d=0,e="";s>=d;e+=N.charAt(g[d++]));e=c(e,u)}return e}function D(e,n,t,i){var o,u,s,f,a;if(t=null!=t&&j(t,0,8,i,w)?0|t:q,!e.c)return e.toString();if(o=e.c[0],s=e.e,null==n)a=r(e.c),a=19==i||24==i&&k>=s?l(a,s):c(a,s);else if(e=L(new h(e),n,t),u=e.e,a=r(e.c),f=a.length,19==i||24==i&&(u>=n||k>=u)){for(;n>f;a+="0",f++);a=l(a,u)}else if(n-=s,a=c(a,u),u+1>f){if(--n>0)for(a+=".";n--;a+="0");}else if(n+=u-f,n>0)for(u+1==f&&(a+=".");n--;a+="0");return e.s<0&&o?"-"+a:a}function F(e,n){var t,r,i=0;for(u(e[0])&&(e=e[0]),t=new h(e[0]);++i<e.length;){if(r=new h(e[i]),!r.s){t=r;break}n.call(t,r)&&(t=r)}return t}function _(e,n,t,r,i){return(n>e||e>t||e!=a(e))&&I(r,(i||"decimal places")+(n>e||e>t?" out of range":" not an integer"),e),!0}function x(e,n,t){for(var r=1,i=n.length;!n[--i];n.pop());for(i=n[0];i>=10;i/=10,r++);return(t=r+t*y-1)>z?e.c=e.e=null:G>t?e.c=[e.e=0]:(e.e=t,e.c=n),e}function I(e,n,t){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][e]+"() "+n+": "+t);throw r.name="BigNumber Error",C=0,r}function L(e,n,t,r){var i,o,u,s,f,l,c,a=e.c,h=R;if(a){e:{for(i=1,s=a[0];s>=10;s/=10,i++);if(o=n-i,0>o)o+=y,u=n,f=a[l=0],c=f/h[i-u-1]%10|0;else if(l=p((o+1)/y),l>=a.length){if(!r)break e;for(;a.length<=l;a.push(0));f=c=0,i=1,o%=y,u=o-y+1}else{for(f=s=a[l],i=1;s>=10;s/=10,i++);o%=y,u=o-y+i,c=0>u?0:f/h[i-u-1]%10|0}if(r=r||0>n||null!=a[l+1]||(0>u?f:f%h[i-u-1]),r=4>t?(c||r)&&(0==t||t==(e.s<0?3:2)):c>5||5==c&&(4==t||r||6==t&&(o>0?u>0?f/h[i-u]:0:a[l-1])%10&1||t==(e.s<0?8:7)),1>n||!a[0])return a.length=0,r?(n-=e.e+1,a[0]=h[(y-n%y)%y],e.e=-n||0):a[0]=e.e=0,e;if(0==o?(a.length=l,s=1,l--):(a.length=l+1,s=h[y-o],a[l]=u>0?d(f/h[i-u]%h[u])*s:0),r)for(;;){if(0==l){for(o=1,u=a[0];u>=10;u/=10,o++);for(u=a[0]+=s,s=1;u>=10;u/=10,s++);o!=s&&(e.e++,a[0]==b&&(a[0]=1));break}if(a[l]+=s,a[l]!=b)break;a[l--]=0,s=1}for(o=a.length;0===a[--o];a.pop());}e.e>z?e.c=e.e=null:e.e<G&&(e.c=[e.e=0])}return e}var U,B,C=0,M=h.prototype,T=new h(1),P=20,q=4,k=-7,$=21,G=-1e7,z=1e7,V=!0,j=_,H=!1,W=1,J=0,X={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0};return h.another=n,h.ROUND_UP=0,h.ROUND_DOWN=1,h.ROUND_CEIL=2,h.ROUND_FLOOR=3,h.ROUND_HALF_UP=4,h.ROUND_HALF_DOWN=5,h.ROUND_HALF_EVEN=6,h.ROUND_HALF_CEIL=7,h.ROUND_HALF_FLOOR=8,h.EUCLID=9,h.config=h.set=function(){var e,n,t=0,r={},i=arguments,s=i[0],f=s&&"object"==typeof s?function(){return s.hasOwnProperty(n)?null!=(e=s[n]):void 0}:function(){return i.length>t?null!=(e=i[t++]):void 0};return f(n="DECIMAL_PLACES")&&j(e,0,A,2,n)&&(P=0|e),r[n]=P,f(n="ROUNDING_MODE")&&j(e,0,8,2,n)&&(q=0|e),r[n]=q,f(n="EXPONENTIAL_AT")&&(u(e)?j(e[0],-A,0,2,n)&&j(e[1],0,A,2,n)&&(k=0|e[0],$=0|e[1]):j(e,-A,A,2,n)&&(k=-($=0|(0>e?-e:e)))),r[n]=[k,$],f(n="RANGE")&&(u(e)?j(e[0],-A,-1,2,n)&&j(e[1],1,A,2,n)&&(G=0|e[0],z=0|e[1]):j(e,-A,A,2,n)&&(0|e?G=-(z=0|(0>e?-e:e)):V&&I(2,n+" cannot be zero",e))),r[n]=[G,z],f(n="ERRORS")&&(e===!!e||1===e||0===e?(C=0,j=(V=!!e)?_:o):V&&I(2,n+m,e)),r[n]=V,f(n="CRYPTO")&&(e===!0||e===!1||1===e||0===e?e?(e="undefined"==typeof crypto,!e&&crypto&&(crypto.getRandomValues||crypto.randomBytes)?H=!0:V?I(2,"crypto unavailable",e?void 0:crypto):H=!1):H=!1:V&&I(2,n+m,e)),r[n]=H,f(n="MODULO_MODE")&&j(e,0,9,2,n)&&(W=0|e),r[n]=W,f(n="POW_PRECISION")&&j(e,0,A,2,n)&&(J=0|e),r[n]=J,f(n="FORMAT")&&("object"==typeof e?X=e:V&&I(2,n+" not an object",e)),r[n]=X,r},h.isBigNumber=s,h.max=function(){return F(arguments,M.lt)},h.min=function(){return F(arguments,M.gt)},h.random=function(){var e=9007199254740992,n=Math.random()*e&2097151?function(){return d(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var t,r,i,o,u,s=0,f=[],l=new h(T);if(e=null!=e&&j(e,0,A,14)?0|e:P,o=p(e/y),H)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));o>s;)u=131072*t[s]+(t[s+1]>>>11),u>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(f.push(u%1e14),s+=2);s=o/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(o*=7);o>s;)u=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6],u>=9e15?crypto.randomBytes(7).copy(t,s):(f.push(u%1e14),s+=7);s=o/7}else H=!1,V&&I(14,"crypto unavailable",crypto);if(!H)for(;o>s;)u=n(),9e15>u&&(f[s++]=u%1e14);for(o=f[--s],e%=y,o&&e&&(u=R[y-e],f[s]=d(o/u)*u);0===f[s];f.pop(),s--);if(0>s)f=[i=0];else{for(i=-1;0===f[0];f.shift(),i-=y);for(s=1,u=f[0];u>=10;u/=10,s++);y>s&&(i-=y-s)}return l.e=i,l.c=f,l}}(),U=function(){function e(e,n,t){var r,i,o,u,s=0,f=e.length,l=n%S,c=n/S|0;for(e=e.slice();f--;)o=e[f]%S,u=e[f]/S|0,r=c*o+u*l,i=l*o+r%S*S+s,s=(i/t|0)+(r/S|0)+c*u,e[f]=i%t;return s&&e.unshift(s),e}function n(e,n,t,r){var i,o;if(t!=r)o=t>r?1:-1;else for(i=o=0;t>i;i++)if(e[i]!=n[i]){o=e[i]>n[i]?1:-1;break}return o}function r(e,n,t,r){for(var i=0;t--;)e[t]-=i,i=e[t]<n[t]?1:0,e[t]=i*r+e[t]-n[t];for(;!e[0]&&e.length>1;e.shift());}return function(i,o,u,s,f){var l,c,a,g,p,m,w,v,N,O,R,S,A,E,D,F,_,x=i.s==o.s?1:-1,I=i.c,U=o.c;if(!(I&&I[0]&&U&&U[0]))return new h(i.s&&o.s&&(I?!U||I[0]!=U[0]:U)?I&&0==I[0]||!U?0*x:x/0:NaN);for(v=new h(x),N=v.c=[],c=i.e-o.e,x=u+c+1,f||(f=b,c=t(i.e/y)-t(o.e/y),x=x/y|0),a=0;U[a]==(I[a]||0);a++);if(U[a]>(I[a]||0)&&c--,0>x)N.push(1),g=!0;else{for(E=I.length,F=U.length,a=0,x+=2,p=d(f/(U[0]+1)),p>1&&(U=e(U,p,f),I=e(I,p,f),F=U.length,E=I.length),A=F,O=I.slice(0,F),R=O.length;F>R;O[R++]=0);_=U.slice(),_.unshift(0),D=U[0],U[1]>=f/2&&D++;do{if(p=0,l=n(U,O,F,R),0>l){if(S=O[0],F!=R&&(S=S*f+(O[1]||0)),p=d(S/D),p>1)for(p>=f&&(p=f-1),m=e(U,p,f),w=m.length,R=O.length;1==n(m,O,w,R);)p--,r(m,w>F?_:U,w,f),w=m.length,l=1;else 0==p&&(l=p=1),m=U.slice(),w=m.length;if(R>w&&m.unshift(0),r(O,m,R,f),R=O.length,-1==l)for(;n(U,O,F,R)<1;)p++,r(O,R>F?_:U,R,f),R=O.length}else 0===l&&(p++,O=[0]);N[a++]=p,O[0]?O[R++]=I[A]||0:(O=[I[A]],R=1)}while((A++<E||null!=O[0])&&x--);g=null!=O[0],N[0]||N.shift()}if(f==b){for(a=1,x=N[0];x>=10;x/=10,a++);L(v,u+(v.e=a+c*y-1)+1,s,g)}else v.e=c,v.r=+g;return v}}(),B=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,n=/^([^.]+)\.$/,t=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,u,s,f){var l,c=s?u:u.replace(i,"");if(r.test(c))o.s=isNaN(c)?null:0>c?-1:1;else{if(!s&&(c=c.replace(e,function(e,n,t){return l="x"==(t=t.toLowerCase())?16:"b"==t?2:8,f&&f!=l?e:n}),f&&(l=f,c=c.replace(n,"$1").replace(t,"0.$1")),u!=c))return new h(c,l);V&&I(C,"not a"+(f?" base "+f:"")+" number",u),o.s=null}o.c=o.e=null,C=0}}(),M.absoluteValue=M.abs=function(){var e=new h(this);return e.s<0&&(e.s=1),e},M.ceil=function(){return L(new h(this),this.e+1,2)},M.comparedTo=M.cmp=function(e,n){return C=1,i(this,new h(e,n))},M.decimalPlaces=M.dp=function(){var e,n,r=this.c;if(!r)return null;if(e=((n=r.length-1)-t(this.e/y))*y,n=r[n])for(;n%10==0;n/=10,e--);return 0>e&&(e=0),e},M.dividedBy=M.div=function(e,n){return C=3,U(this,new h(e,n),P,q)},M.dividedToIntegerBy=M.divToInt=function(e,n){return C=4,U(this,new h(e,n),0,1)},M.equals=M.eq=function(e,n){return C=5,0===i(this,new h(e,n))},M.floor=function(){return L(new h(this),this.e+1,3)},M.greaterThan=M.gt=function(e,n){return C=6,i(this,new h(e,n))>0},M.greaterThanOrEqualTo=M.gte=function(e,n){return C=7,1===(n=i(this,new h(e,n)))||0===n},M.isFinite=function(){return!!this.c},M.isInteger=M.isInt=function(){return!!this.c&&t(this.e/y)>this.c.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.lessThan=M.lt=function(e,n){return C=8,i(this,new h(e,n))<0},M.lessThanOrEqualTo=M.lte=function(e,n){return C=9,-1===(n=i(this,new h(e,n)))||0===n},M.minus=M.sub=function(e,n){var r,i,o,u,s=this,f=s.s;if(C=10,e=new h(e,n),n=e.s,!f||!n)return new h(NaN);if(f!=n)return e.s=-n,s.plus(e);var l=s.e/y,c=e.e/y,a=s.c,g=e.c;if(!l||!c){if(!a||!g)return a?(e.s=-n,e):new h(g?s:NaN);if(!a[0]||!g[0])return g[0]?(e.s=-n,e):new h(a[0]?s:3==q?-0:0)}if(l=t(l),c=t(c),a=a.slice(),f=l-c){for((u=0>f)?(f=-f,o=a):(c=l,o=g),o.reverse(),n=f;n--;o.push(0));o.reverse()}else for(i=(u=(f=a.length)<(n=g.length))?f:n,f=n=0;i>n;n++)if(a[n]!=g[n]){u=a[n]<g[n];break}if(u&&(o=a,a=g,g=o,e.s=-e.s),n=(i=g.length)-(r=a.length),n>0)for(;n--;a[r++]=0);for(n=b-1;i>f;){if(a[--i]<g[i]){for(r=i;r&&!a[--r];a[r]=n);--a[r],a[i]+=b}a[i]-=g[i]}for(;0==a[0];a.shift(),--c);return a[0]?x(e,a,c):(e.s=3==q?-1:1,e.c=[e.e=0],e)},M.modulo=M.mod=function(e,n){var t,r,i=this;return C=11,e=new h(e,n),!i.c||!e.s||e.c&&!e.c[0]?new h(NaN):!e.c||i.c&&!i.c[0]?new h(i):(9==W?(r=e.s,e.s=1,t=U(i,e,0,3),e.s=r,t.s*=r):t=U(i,e,0,W),i.minus(t.times(e)))},M.negated=M.neg=function(){var e=new h(this);return e.s=-e.s||null,e},M.plus=M.add=function(e,n){var r,i=this,o=i.s;if(C=12,e=new h(e,n),n=e.s,!o||!n)return new h(NaN);if(o!=n)return e.s=-n,i.minus(e);var u=i.e/y,s=e.e/y,f=i.c,l=e.c;if(!u||!s){if(!f||!l)return new h(o/0);if(!f[0]||!l[0])return l[0]?e:new h(f[0]?i:0*o)}if(u=t(u),s=t(s),f=f.slice(),o=u-s){for(o>0?(s=u,r=l):(o=-o,r=f),r.reverse();o--;r.push(0));r.reverse()}for(o=f.length,n=l.length,0>o-n&&(r=l,l=f,f=r,n=o),o=0;n;)o=(f[--n]=f[n]+l[n]+o)/b|0,f[n]=b===f[n]?0:f[n]%b;return o&&(f.unshift(o),++s),x(e,f,s)},M.precision=M.sd=function(e){var n,t,r=this,i=r.c;if(null!=e&&e!==!!e&&1!==e&&0!==e&&(V&&I(13,"argument"+m,e),e!=!!e&&(e=null)),!i)return null;if(t=i.length-1,n=t*y+1,t=i[t]){for(;t%10==0;t/=10,n--);for(t=i[0];t>=10;t/=10,n++);}return e&&r.e+1>n&&(n=r.e+1),n},M.round=function(e,n){var t=new h(this);return(null==e||j(e,0,A,15))&&L(t,~~e+this.e+1,null!=n&&j(n,0,8,15,w)?0|n:q),t},M.shift=function(e){var n=this;return j(e,-O,O,16,"argument")?n.times("1e"+a(e)):new h(n.c&&n.c[0]&&(-O>e||e>O)?n.s*(0>e?0:1/0):n)},M.squareRoot=M.sqrt=function(){var e,n,i,o,u,s=this,f=s.c,l=s.s,c=s.e,a=P+4,g=new h("0.5");if(1!==l||!f||!f[0])return new h(!l||0>l&&(!f||f[0])?NaN:f?s:1/0);if(l=Math.sqrt(+s),0==l||l==1/0?(n=r(f),(n.length+c)%2==0&&(n+="0"),l=Math.sqrt(n),c=t((c+1)/2)-(0>c||c%2),l==1/0?n="1e"+c:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+c),i=new h(n)):i=new h(l+""),i.c[0])for(c=i.e,l=c+a,3>l&&(l=0);;)if(u=i,i=g.times(u.plus(U(s,u,a,1))),r(u.c).slice(0,l)===(n=r(i.c)).slice(0,l)){if(i.e<c&&--l,n=n.slice(l-3,l+1),"9999"!=n&&(o||"4999"!=n)){(!+n||!+n.slice(1)&&"5"==n.charAt(0))&&(L(i,i.e+P+2,1),e=!i.times(i).eq(s));break}if(!o&&(L(u,u.e+P+2,0),u.times(u).eq(s))){i=u;break}a+=4,l+=4,o=1}return L(i,i.e+P+1,q,e)},M.times=M.mul=function(e,n){var r,i,o,u,s,f,l,c,a,g,p,d,m,w,v,N=this,O=N.c,R=(C=17,e=new h(e,n)).c;if(!(O&&R&&O[0]&&R[0]))return!N.s||!e.s||O&&!O[0]&&!R||R&&!R[0]&&!O?e.c=e.e=e.s=null:(e.s*=N.s,O&&R?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=t(N.e/y)+t(e.e/y),e.s*=N.s,l=O.length,g=R.length,g>l&&(m=O,O=R,R=m,o=l,l=g,g=o),o=l+g,m=[];o--;m.push(0));for(w=b,v=S,o=g;--o>=0;){for(r=0,p=R[o]%v,d=R[o]/v|0,s=l,u=o+s;u>o;)c=O[--s]%v,a=O[s]/v|0,f=d*c+a*p,c=p*c+f%v*v+m[u]+r,r=(c/w|0)+(f/v|0)+d*a,m[u--]=c%w;m[u]=r}return r?++i:m.shift(),x(e,m,i)},M.toDigits=function(e,n){var t=new h(this);return e=null!=e&&j(e,1,A,18,"precision")?0|e:null,n=null!=n&&j(n,0,8,18,w)?0|n:q,e?L(t,e,n):t},M.toExponential=function(e,n){return D(this,null!=e&&j(e,0,A,19)?~~e+1:null,n,19)},M.toFixed=function(e,n){return D(this,null!=e&&j(e,0,A,20)?~~e+this.e+1:null,n,20)},M.toFormat=function(e,n){var t=D(this,null!=e&&j(e,0,A,21)?~~e+this.e+1:null,n,21);if(this.c){var r,i=t.split("."),o=+X.groupSize,u=+X.secondaryGroupSize,s=X.groupSeparator,f=i[0],l=i[1],c=this.s<0,a=c?f.slice(1):f,h=a.length;if(u&&(r=o,o=u,u=r,h-=r),o>0&&h>0){for(r=h%o||o,f=a.substr(0,r);h>r;r+=o)f+=s+a.substr(r,o);u>0&&(f+=s+a.slice(r)),c&&(f="-"+f)}t=l?f+X.decimalSeparator+((u=+X.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+X.fractionGroupSeparator):l):f}return t},M.toFraction=function(e){var n,t,i,o,u,s,f,l,c,a=V,g=this,p=g.c,d=new h(T),m=t=new h(T),w=f=new h(T);if(null!=e&&(V=!1,s=new h(e),V=a,(!(a=s.isInt())||s.lt(T))&&(V&&I(22,"max denominator "+(a?"out of range":"not an integer"),e),e=!a&&s.c&&L(s,s.e+1,1).gte(T)?s:null)),!p)return g.toString();for(c=r(p),o=d.e=c.length-g.e-1,d.c[0]=R[(u=o%y)<0?y+u:u],e=!e||s.cmp(d)>0?o>0?d:m:s,u=z,z=1/0,s=new h(c),f.c[0]=0;l=U(s,d,0,1),i=t.plus(l.times(w)),1!=i.cmp(e);)t=w,w=i,m=f.plus(l.times(i=m)),f=i,d=s.minus(l.times(i=d)),s=i;return i=U(e.minus(t),w,0,1),f=f.plus(i.times(m)),t=t.plus(i.times(w)),f.s=m.s=g.s,o*=2,n=U(m,w,o,q).minus(g).abs().cmp(U(f,t,o,q).minus(g).abs())<1?[m.toString(),w.toString()]:[f.toString(),t.toString()],z=u,n},M.toNumber=function(){return+this},M.toPower=M.pow=function(e,n){var t,r,i,o=d(0>e?-e:+e),u=this;if(null!=n&&(C=23,n=new h(n)),!j(e,-O,O,23,"exponent")&&(!isFinite(e)||o>O&&(e/=0)||parseFloat(e)!=e&&!(e=NaN))||0==e)return t=Math.pow(+u,e),new h(n?t%n:t);for(n?e>1&&u.gt(T)&&u.isInt()&&n.gt(T)&&n.isInt()?u=u.mod(n):(i=n,n=null):J&&(t=p(J/y+2)),r=new h(T);;){if(o%2){if(r=r.times(u),!r.c)break;t?r.c.length>t&&(r.c.length=t):n&&(r=r.mod(n))}if(o=d(o/2),!o)break;u=u.times(u),t?u.c&&u.c.length>t&&(u.c.length=t):n&&(u=u.mod(n))}return n?r:(0>e&&(r=T.div(r)),i?r.mod(i):t?L(r,J,q):r)},M.toPrecision=function(e,n){return D(this,null!=e&&j(e,1,A,24,"precision")?0|e:null,n,24)},M.toString=function(e){var n,t=this,i=t.s,o=t.e;return null===o?i?(n="Infinity",0>i&&(n="-"+n)):n="NaN":(n=r(t.c),n=null!=e&&j(e,2,64,25,"base")?E(c(n,o),0|e,10,i):k>=o||o>=$?l(n,o):c(n,o),0>i&&t.c[0]&&(n="-"+n)),n},M.truncated=M.trunc=function(){return L(new h(this),this.e+1,1)},M.valueOf=M.toJSON=function(){var e,n=this,t=n.e;return null===t?n.toString():(e=r(n.c),e=k>=t||t>=$?l(e,t):c(e,t),n.s<0?"-"+e:e)},null!=e&&h.config(e),h}function t(e){var n=0|e;return e>0||e===n?n:n-1}function r(e){for(var n,t,r=1,i=e.length,o=e[0]+"";i>r;){for(n=e[r++]+"",t=y-n.length;t--;n="0"+n);o+=n}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function i(e,n){var t,r,i=e.c,o=n.c,u=e.s,s=n.s,f=e.e,l=n.e;if(!u||!s)return null;if(t=i&&!i[0],r=o&&!o[0],t||r)return t?r?0:-s:u;if(u!=s)return u;if(t=0>u,r=f==l,!i||!o)return r?0:!i^t?1:-1;if(!r)return f>l^t?1:-1;for(s=(f=i.length)<(l=o.length)?f:l,u=0;s>u;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return f==l?0:f>l^t?1:-1}function o(e,n,t){return(e=a(e))>=n&&t>=e}function u(e){return"[object Array]"==Object.prototype.toString.call(e)}function s(e){return!(!e||!e.constructor||e.constructor.isBigNumber!==s)}function f(e,n,t){for(var r,i,o=[0],u=0,s=e.length;s>u;){for(i=o.length;i--;o[i]*=n);for(o[r=0]+=N.indexOf(e.charAt(u++));r<o.length;r++)o[r]>t-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/t|0,o[r]%=t)}return o.reverse()}function l(e,n){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>n?"e":"e+")+n}function c(e,n){var t,r;if(0>n){for(r="0.";++n;r+="0");e=r+e}else if(t=e.length,++n>t){for(r="0",n-=t;--n;r+="0");e+=r}else t>n&&(e=e.slice(0,n)+"."+e.slice(n));return e}function a(e){return e=parseFloat(e),0>e?p(e):d(e)}var h,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,p=Math.ceil,d=Math.floor,m=" not a boolean or binary digit",w="rounding mode",v="number type has more than 15 significant digits",N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",b=1e14,y=14,O=9007199254740991,R=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],S=1e7,A=1e9;h=n(),h["default"]=h.BigNumber=h,"function"==typeof define&&define.amd?define(function(){return h}):"undefined"!=typeof module&&module.exports?module.exports=h:(e||(e="undefined"!=typeof self?self:Function("return this")()),e.BigNumber=h)}(this);
//# sourceMappingURL=bignumber.js.map
{
"name": "bignumber.js",
"main": "bignumber.js",
"version": "3.0.0",
"version": "3.1.0",
"homepage": "https://github.com/MikeMcl/bignumber.js",

@@ -6,0 +6,0 @@ "authors": [

{
"name": "bignumber.js",
"description": "A library for arbitrary-precision decimal and non-decimal arithmetic",
"version": "3.0.1",
"version": "3.1.0",
"keywords": [

@@ -34,4 +34,4 @@ "arbitrary",

"test": "node ./test/every-test.js",
"build": "uglifyjs bignumber.js --source-map bignumber.js.map -c -m -o bignumber.min.js --preamble \"/* bignumber.js v3.0.1 https://github.com/MikeMcl/bignumber.js/LICENCE */\""
"build": "uglifyjs bignumber.js --source-map bignumber.js.map -c -m -o bignumber.min.js --preamble \"/* bignumber.js v3.1.0 https://github.com/MikeMcl/bignumber.js/LICENCE */\""
}
}

@@ -210,3 +210,3 @@ ![bignumber.js](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/bignumberjs.png)

This is version 2.x.x of the library, for version 1.x.x see the tagged releases or switch to the 'original' branch. The advantages of version 2 are that it is considerably faster for numbers with many digits and that there are a some added methods (see Change Log below). The disadvantages are more lines of code and increased code complexity, and the loss of simplicity in no longer having the coefficient of a BigNumber stored in base 10. The 'original' version will continue to be supported.
Version 1.x.x of this library is still supported on the 'original' branch. The advantages of later versions are that they are considerably faster for numbers with many digits and that there are some added methods (see Change Log below). The disadvantages are more lines of code and increased code complexity, and the loss of simplicity in no longer having the coefficient of a BigNumber stored in base 10.

@@ -247,2 +247,10 @@ ## Performance

#### 3.1.0
* 08/01/2017
* Add `isBigNumber` method.
#### 3.0.2
* 08/01/2017
* Bugfix: Possible incorrect value of `ERRORS` after a `BigNumber.another` call (due to `parseNumeric` declaration in outer scope).
#### 3.0.1

@@ -249,0 +257,0 @@ * 23/11/2016

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc