Socket
Socket
Sign inDemoInstall

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 7.0.0 to 7.0.1

4

bignumber.min.js

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

/* bignumber.js v7.0.0 https://github.com/MikeMcl/bignumber.js/LICENCE */
!function(e){"use strict";function r(e){function l(e,r){var n,t,i,s,u,f,c,h=this;if(!(h instanceof l))return new l(e,r);if(null==r){if(e instanceof l)return h.s=e.s,h.e=e.e,void(h.c=(e=e.c)?e.slice():e);if(u="number"==typeof e,u&&0*e==0){if(h.s=0>1/e?(e=-e,-1):1,e===~~e){for(i=0,s=e;s>=10;s/=10,i++);return h.e=i,void(h.c=[e])}c=e+""}else{if(!a.test(c=e+""))return _(h,c,u);h.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}}else{if(o(r,2,q.length,"Base"),c=e+"",10==r)return h=new l(e instanceof l?e:c),S(h,B+h.e+1,I);if(u="number"==typeof e){if(0*e!=0)return _(h,c,u,r);if(h.s=0>1/e?(c=c.slice(1),-1):1,l.DEBUG&&c.replace(/^0\.0*|\./,"").length>15)throw Error(w+e);u=!1}else h.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,r>10&&37>r&&(c=c.toLowerCase());for(n=q.slice(0,r),i=s=0,f=c.length;f>s;s++)if(n.indexOf(t=c.charAt(s))<0){if("."==t&&s>i){i=f;continue}return _(h,e+"",u,r)}c=P(c,r,10,h.s)}for((i=c.indexOf("."))>-1&&(c=c.replace(".","")),(s=c.search(/e/i))>0?(0>i&&(i=s),i+=+c.slice(s+1),c=c.substring(0,s)):0>i&&(i=c.length),s=0;48===c.charCodeAt(s);s++);for(f=c.length;48===c.charCodeAt(--f););if(c=c.slice(s,++f)){if(f-=s,u&&l.DEBUG&&f>15&&(e>v||e!==g(e)))throw Error(w+h.s*e);if(i=i-s-1,i>M)h.c=h.e=null;else if(x>i)h.c=[h.e=0];else{if(h.e=i,h.c=[],s=(i+1)%m,0>i&&(s+=m),f>s){for(s&&h.c.push(+c.slice(0,s)),f-=m;f>s;)h.c.push(+c.slice(s,s+=m));c=c.slice(s),s=m-c.length}else s-=f;for(;s--;c+="0");h.c.push(+c)}}else h.c=[h.e=0]}function E(e,r,n,i){var s,u,a,h,g;if(null==n?n=I:o(n,0,8),!e.c)return e.toString();if(s=e.c[0],a=e.e,null==r)g=t(e.c),g=1==i||2==i&&T>=a?f(g,a):c(g,a,"0");else if(e=S(new l(e),r,n),u=e.e,g=t(e.c),h=g.length,1==i||2==i&&(u>=r||T>=u)){for(;r>h;g+="0",h++);g=f(g,u)}else if(r-=a,g=c(g,u,"0"),u+1>h){if(--r>0)for(g+=".";r--;g+="0");}else if(r+=u-h,r>0)for(u+1==h&&(g+=".");r--;g+="0");return e.s<0&&s?"-"+g:g}function b(e,r){var n,t,i=0;for(s(e[0])&&(e=e[0]),n=new l(e[0]);++i<e.length;){if(t=new l(e[i]),!t.s){n=t;break}r.call(n,t)&&(n=t)}return n}function A(e,r,n){for(var t=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,t++);return(n=t+n*m-1)>M?e.c=e.e=null:x>n?e.c=[e.e=0]:(e.e=n,e.c=r),e}function S(e,r,n,t){var i,o,s,u,f,c,l,a=e.c,p=N;if(a){e:{for(i=1,u=a[0];u>=10;u/=10,i++);if(o=r-i,0>o)o+=m,s=r,f=a[c=0],l=f/p[i-s-1]%10|0;else if(c=h((o+1)/m),c>=a.length){if(!t)break e;for(;a.length<=c;a.push(0));f=l=0,i=1,o%=m,s=o-m+1}else{for(f=u=a[c],i=1;u>=10;u/=10,i++);o%=m,s=o-m+i,l=0>s?0:f/p[i-s-1]%10|0}if(t=t||0>r||null!=a[c+1]||(0>s?f:f%p[i-s-1]),t=4>n?(l||t)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||t||6==n&&(o>0?s>0?f/p[i-s]:0:a[c-1])%10&1||n==(e.s<0?8:7)),1>r||!a[0])return a.length=0,t?(r-=e.e+1,a[0]=p[(m-r%m)%m],e.e=-r||0):a[0]=e.e=0,e;if(0==o?(a.length=c,u=1,c--):(a.length=c+1,u=p[m-o],a[c]=s>0?g(f/p[i-s]%p[s])*u:0),t)for(;;){if(0==c){for(o=1,s=a[0];s>=10;s/=10,o++);for(s=a[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,a[0]==d&&(a[0]=1));break}if(a[c]+=u,a[c]!=d)break;a[c--]=0,u=1}for(o=a.length;0===a[--o];a.pop());}e.e>M?e.c=e.e=null:e.e<x&&(e.c=[e.e=0])}return e}var R,P,_,D=l.prototype={constructor:l,toString:null,valueOf:null},L=new l(1),B=20,I=4,T=-7,U=21,x=-1e7,M=1e7,C=!1,G=1,F=0,k={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},q="0123456789abcdefghijklmnopqrstuvwxyz";return l.clone=r,l.ROUND_UP=0,l.ROUND_DOWN=1,l.ROUND_CEIL=2,l.ROUND_FLOOR=3,l.ROUND_HALF_UP=4,l.ROUND_HALF_DOWN=5,l.ROUND_HALF_EVEN=6,l.ROUND_HALF_CEIL=7,l.ROUND_HALF_FLOOR=8,l.EUCLID=9,l.config=l.set=function(e){var r,n;if(null!=e){if("object"!=typeof e)throw Error(p+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(n=e[r],o(n,0,y,r),B=n),e.hasOwnProperty(r="ROUNDING_MODE")&&(n=e[r],o(n,0,8,r),I=n),e.hasOwnProperty(r="EXPONENTIAL_AT")&&(n=e[r],s(n)?(o(n[0],-y,0,r),o(n[1],0,y,r),T=n[0],U=n[1]):(o(n,-y,y,r),T=-(U=0>n?-n:n))),e.hasOwnProperty(r="RANGE"))if(n=e[r],s(n))o(n[0],-y,-1,r),o(n[1],1,y,r),x=n[0],M=n[1];else{if(o(n,-y,y,r),!n)throw Error(p+r+" cannot be zero: "+n);x=-(M=0>n?-n:n)}if(e.hasOwnProperty(r="CRYPTO")){if(n=e[r],n!==!!n)throw Error(p+r+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw C=!n,Error(p+"crypto unavailable");C=n}else C=n}if(e.hasOwnProperty(r="MODULO_MODE")&&(n=e[r],o(n,0,9,r),G=n),e.hasOwnProperty(r="POW_PRECISION")&&(n=e[r],o(n,0,y,r),F=n),e.hasOwnProperty(r="FORMAT")){if(n=e[r],"object"!=typeof n)throw Error(p+r+" not an object: "+n);k=n}if(e.hasOwnProperty(r="ALPHABET")){if(n=e[r],"string"!=typeof n||/^.$|\.|(.).*\1/.test(n))throw Error(p+r+" invalid: "+n);q=n}}return{DECIMAL_PLACES:B,ROUNDING_MODE:I,EXPONENTIAL_AT:[T,U],RANGE:[x,M],CRYPTO:C,MODULO_MODE:G,POW_PRECISION:F,FORMAT:k,ALPHABET:q}},l.isBigNumber=function(e){return e instanceof l||e&&e._isBigNumber===!0||!1},l.maximum=l.max=function(){return b(arguments,D.lt)},l.minimum=l.min=function(){return b(arguments,D.gt)},l.random=function(){var e=9007199254740992,r=Math.random()*e&2097151?function(){return g(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var n,t,i,s,u,f=0,c=[],a=new l(L);if(null==e?e=B:o(e,0,y),s=h(e/m),C)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));s>f;)u=131072*n[f]+(n[f+1]>>>11),u>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),n[f]=t[0],n[f+1]=t[1]):(c.push(u%1e14),f+=2);f=s/2}else{if(!crypto.randomBytes)throw C=!1,Error(p+"crypto unavailable");for(n=crypto.randomBytes(s*=7);s>f;)u=281474976710656*(31&n[f])+1099511627776*n[f+1]+4294967296*n[f+2]+16777216*n[f+3]+(n[f+4]<<16)+(n[f+5]<<8)+n[f+6],u>=9e15?crypto.randomBytes(7).copy(n,f):(c.push(u%1e14),f+=7);f=s/7}if(!C)for(;s>f;)u=r(),9e15>u&&(c[f++]=u%1e14);for(s=c[--f],e%=m,s&&e&&(u=N[m-e],c[f]=g(s/u)*u);0===c[f];c.pop(),f--);if(0>f)c=[i=0];else{for(i=-1;0===c[0];c.splice(0,1),i-=m);for(f=1,u=c[0];u>=10;u/=10,f++);m>f&&(i-=m-f)}return a.e=i,a.c=c,a}}(),P=function(){function e(e,r,n,t){for(var i,o,s=[0],u=0,f=e.length;f>u;){for(o=s.length;o--;s[o]*=r);for(s[0]+=t.indexOf(e.charAt(u++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}var r="0123456789";return function(n,i,o,s,u){var f,a,h,g,p,w,d,m,v=n.indexOf("."),N=B,O=I;for(v>=0&&(g=F,F=0,n=n.replace(".",""),m=new l(i),w=m.pow(n.length-v),F=g,m.c=e(c(t(w.c),w.e,"0"),10,o,r),m.e=m.c.length),d=e(n,i,o,u?(f=q,r):(f=r,q)),h=g=d.length;0==d[--g];d.pop());if(!d[0])return f.charAt(0);if(0>v?--h:(w.c=d,w.e=h,w.s=s,w=R(w,m,N,O,o),d=w.c,p=w.r,h=w.e),a=h+N+1,v=d[a],g=o/2,p=p||0>a||null!=d[a+1],p=4>O?(null!=v||p)&&(0==O||O==(w.s<0?3:2)):v>g||v==g&&(4==O||p||6==O&&1&d[a-1]||O==(w.s<0?8:7)),1>a||!d[0])n=p?c(f.charAt(1),-N,f.charAt(0)):f.charAt(0);else{if(d.length=a,p)for(--o;++d[--a]>o;)d[a]=0,a||(++h,d=[1].concat(d));for(g=d.length;!d[--g];);for(v=0,n="";g>=v;n+=f.charAt(d[v++]));n=c(n,h,f.charAt(0))}return n}}(),R=function(){function e(e,r,n){var t,i,o,s,u=0,f=e.length,c=r%O,l=r/O|0;for(e=e.slice();f--;)o=e[f]%O,s=e[f]/O|0,t=l*o+s*c,i=c*o+t%O*O+u,u=(i/n|0)+(t/O|0)+l*s,e[f]=i%n;return u&&(e=[u].concat(e)),e}function r(e,r,n,t){var i,o;if(n!=t)o=n>t?1:-1;else for(i=o=0;n>i;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function t(e,r,n,t){for(var i=0;n--;)e[n]-=i,i=e[n]<r[n]?1:0,e[n]=i*t+e[n]-r[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,o,s,u,f){var c,a,h,p,w,v,N,O,y,E,b,A,R,P,_,D,L,B=i.s==o.s?1:-1,I=i.c,T=o.c;if(!(I&&I[0]&&T&&T[0]))return new l(i.s&&o.s&&(I?!T||I[0]!=T[0]:T)?I&&0==I[0]||!T?0*B:B/0:NaN);for(O=new l(B),y=O.c=[],a=i.e-o.e,B=s+a+1,f||(f=d,a=n(i.e/m)-n(o.e/m),B=B/m|0),h=0;T[h]==(I[h]||0);h++);if(T[h]>(I[h]||0)&&a--,0>B)y.push(1),p=!0;else{for(P=I.length,D=T.length,h=0,B+=2,w=g(f/(T[0]+1)),w>1&&(T=e(T,w,f),I=e(I,w,f),D=T.length,P=I.length),R=D,E=I.slice(0,D),b=E.length;D>b;E[b++]=0);L=T.slice(),L=[0].concat(L),_=T[0],T[1]>=f/2&&_++;do{if(w=0,c=r(T,E,D,b),0>c){if(A=E[0],D!=b&&(A=A*f+(E[1]||0)),w=g(A/_),w>1)for(w>=f&&(w=f-1),v=e(T,w,f),N=v.length,b=E.length;1==r(v,E,N,b);)w--,t(v,N>D?L:T,N,f),N=v.length,c=1;else 0==w&&(c=w=1),v=T.slice(),N=v.length;if(b>N&&(v=[0].concat(v)),t(E,v,b,f),b=E.length,-1==c)for(;r(T,E,D,b)<1;)w++,t(E,b>D?L:T,b,f),b=E.length}else 0===c&&(w++,E=[0]);y[h++]=w,E[0]?E[b++]=I[R]||0:(E=[I[R]],b=1)}while((R++<P||null!=E[0])&&B--);p=null!=E[0],y[0]||y.splice(0,1)}if(f==d){for(h=1,B=y[0];B>=10;B/=10,h++);S(O,s+(O.e=h+a*m-1)+1,u,p)}else O.e=a,O.r=+p;return O}}(),_=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,r=/^([^.]+)\.$/,n=/^\.([^.]+)$/,t=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,s,u,f){var c,a=u?s:s.replace(i,"");if(t.test(a))o.s=isNaN(a)?null:0>a?-1:1,o.c=o.e=null;else{if(!u&&(a=a.replace(e,function(e,r,n){return c="x"==(n=n.toLowerCase())?16:"b"==n?2:8,f&&f!=c?e:r}),f&&(c=f,a=a.replace(r,"$1").replace(n,"0.$1")),s!=a))return new l(a,c);if(l.DEBUG)throw Error(p+"Not a"+(f?" base "+f:"")+" number: "+s);o.c=o.e=o.s=null}}}(),D.absoluteValue=D.abs=function(){var e=new l(this);return e.s<0&&(e.s=1),e},D.comparedTo=function(e,r){return i(this,new l(e,r))},D.decimalPlaces=D.dp=function(e,r){var t,i,s,u=this;if(null!=e)return o(e,0,y),null==r?r=I:o(r,0,8),S(new l(u),e+u.e+1,r);if(!(t=u.c))return null;if(i=((s=t.length-1)-n(this.e/m))*m,s=t[s])for(;s%10==0;s/=10,i--);return 0>i&&(i=0),i},D.dividedBy=D.div=function(e,r){return R(this,new l(e,r),B,I)},D.dividedToIntegerBy=D.idiv=function(e,r){return R(this,new l(e,r),0,1)},D.exponentiatedBy=D.pow=function(e,r){var n,t,i,o,s,f,c,a,w=this;if(e=new l(e),e.c&&!e.isInteger())throw Error(p+"Exponent not an integer: "+e);if(null!=r&&(r=new l(r)),s=e.e>14,!w.c||!w.c[0]||1==w.c[0]&&!w.e&&1==w.c.length||!e.c||!e.c[0])return a=new l(Math.pow(+w.valueOf(),s?2-u(e):+e)),r?a.mod(r):a;if(f=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new l(NaN);t=!f&&w.isInteger()&&r.isInteger(),t&&(w=w.mod(r))}else{if(e.e>9&&(w.e>0||w.e<-1||(0==w.e?w.c[0]>1||s&&w.c[1]>=24e7:w.c[0]<8e13||s&&w.c[0]<=9999975e7)))return i=w.s<0&&u(e)?-0:0,w.e>-1&&(i=1/i),new l(f?1/i:i);F&&(i=h(F/m+2))}for(s?(n=new l(.5),c=u(e)):c=e%2,f&&(e.s=1),a=new l(L);;){if(c){if(a=a.times(w),!a.c)break;i?a.c.length>i&&(a.c.length=i):t&&(a=a.mod(r))}if(s){if(e=e.times(n),S(e,e.e+1,1),!e.c[0])break;s=e.e>14,c=u(e)}else{if(e=g(e/2),!e)break;c=e%2}w=w.times(w),i?w.c&&w.c.length>i&&(w.c.length=i):t&&(w=w.mod(r))}return t?a:(f&&(a=L.div(a)),r?a.mod(r):i?S(a,F,I,o):a)},D.integerValue=function(e){var r=new l(this);return null==e?e=I:o(e,0,8),S(r,r.e+1,e)},D.isEqualTo=D.eq=function(e,r){return 0===i(this,new l(e,r))},D.isFinite=function(){return!!this.c},D.isGreaterThan=D.gt=function(e,r){return i(this,new l(e,r))>0},D.isGreaterThanOrEqualTo=D.gte=function(e,r){return 1===(r=i(this,new l(e,r)))||0===r},D.isInteger=function(){return!!this.c&&n(this.e/m)>this.c.length-2},D.isLessThan=D.lt=function(e,r){return i(this,new l(e,r))<0},D.isLessThanOrEqualTo=D.lte=function(e,r){return-1===(r=i(this,new l(e,r)))||0===r},D.isNaN=function(){return!this.s},D.isNegative=function(){return this.s<0},D.isPositive=function(){return this.s>0},D.isZero=function(){return!!this.c&&0==this.c[0]},D.minus=function(e,r){var t,i,o,s,u=this,f=u.s;if(e=new l(e,r),r=e.s,!f||!r)return new l(NaN);if(f!=r)return e.s=-r,u.plus(e);var c=u.e/m,a=e.e/m,h=u.c,g=e.c;if(!c||!a){if(!h||!g)return h?(e.s=-r,e):new l(g?u:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-r,e):new l(h[0]?u:3==I?-0:0)}if(c=n(c),a=n(a),h=h.slice(),f=c-a){for((s=0>f)?(f=-f,o=h):(a=c,o=g),o.reverse(),r=f;r--;o.push(0));o.reverse()}else for(i=(s=(f=h.length)<(r=g.length))?f:r,f=r=0;i>r;r++)if(h[r]!=g[r]){s=h[r]<g[r];break}if(s&&(o=h,h=g,g=o,e.s=-e.s),r=(i=g.length)-(t=h.length),r>0)for(;r--;h[t++]=0);for(r=d-1;i>f;){if(h[--i]<g[i]){for(t=i;t&&!h[--t];h[t]=r);--h[t],h[i]+=d}h[i]-=g[i]}for(;0==h[0];h.splice(0,1),--a);return h[0]?A(e,h,a):(e.s=3==I?-1:1,e.c=[e.e=0],e)},D.modulo=D.mod=function(e,r){var n,t,i=this;return e=new l(e,r),!i.c||!e.s||e.c&&!e.c[0]?new l(NaN):!e.c||i.c&&!i.c[0]?new l(i):(9==G?(t=e.s,e.s=1,n=R(i,e,0,3),e.s=t,n.s*=t):n=R(i,e,0,G),e=i.minus(n.times(e)),e.c[0]||1!=G||(e.s=i.s),e)},D.multipliedBy=D.times=function(e,r){var t,i,o,s,u,f,c,a,h,g,p,w,v,N,y,E=this,b=E.c,S=(e=new l(e,r)).c;if(!(b&&S&&b[0]&&S[0]))return!E.s||!e.s||b&&!b[0]&&!S||S&&!S[0]&&!b?e.c=e.e=e.s=null:(e.s*=E.s,b&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=n(E.e/m)+n(e.e/m),e.s*=E.s,c=b.length,g=S.length,g>c&&(v=b,b=S,S=v,o=c,c=g,g=o),o=c+g,v=[];o--;v.push(0));for(N=d,y=O,o=g;--o>=0;){for(t=0,p=S[o]%y,w=S[o]/y|0,u=c,s=o+u;s>o;)a=b[--u]%y,h=b[u]/y|0,f=w*a+h*p,a=p*a+f%y*y+v[s]+t,t=(a/N|0)+(f/y|0)+w*h,v[s--]=a%N;v[s]=t}return t?++i:v.splice(0,1),A(e,v,i)},D.negated=function(){var e=new l(this);return e.s=-e.s||null,e},D.plus=function(e,r){var t,i=this,o=i.s;if(e=new l(e,r),r=e.s,!o||!r)return new l(NaN);if(o!=r)return e.s=-r,i.minus(e);var s=i.e/m,u=e.e/m,f=i.c,c=e.c;if(!s||!u){if(!f||!c)return new l(o/0);if(!f[0]||!c[0])return c[0]?e:new l(f[0]?i:0*o)}if(s=n(s),u=n(u),f=f.slice(),o=s-u){for(o>0?(u=s,t=c):(o=-o,t=f),t.reverse();o--;t.push(0));t.reverse()}for(o=f.length,r=c.length,0>o-r&&(t=c,c=f,f=t,r=o),o=0;r;)o=(f[--r]=f[r]+c[r]+o)/d|0,f[r]=d===f[r]?0:f[r]%d;return o&&(f=[o].concat(f),++u),A(e,f,u)},D.precision=D.sd=function(e,r){var n,t,i,s=this;if(null!=e&&e!==!!e)return o(e,1,y),null==r?r=I:o(r,0,8),S(new l(s),e,r);if(!(n=s.c))return null;if(i=n.length-1,t=i*m+1,i=n[i]){for(;i%10==0;i/=10,t--);for(i=n[0];i>=10;i/=10,t++);}return e&&s.e+1>t&&(t=s.e+1),t},D.shiftedBy=function(e){return o(e,-v,v),this.times("1e"+e)},D.squareRoot=D.sqrt=function(){var e,r,i,o,s,u=this,f=u.c,c=u.s,a=u.e,h=B+4,g=new l("0.5");if(1!==c||!f||!f[0])return new l(!c||0>c&&(!f||f[0])?NaN:f?u:1/0);if(c=Math.sqrt(+u),0==c||c==1/0?(r=t(f),(r.length+a)%2==0&&(r+="0"),c=Math.sqrt(r),a=n((a+1)/2)-(0>a||a%2),c==1/0?r="1e"+a:(r=c.toExponential(),r=r.slice(0,r.indexOf("e")+1)+a),i=new l(r)):i=new l(c+""),i.c[0])for(a=i.e,c=a+h,3>c&&(c=0);;)if(s=i,i=g.times(s.plus(R(u,s,h,1))),t(s.c).slice(0,c)===(r=t(i.c)).slice(0,c)){if(i.e<a&&--c,r=r.slice(c-3,c+1),"9999"!=r&&(o||"4999"!=r)){(!+r||!+r.slice(1)&&"5"==r.charAt(0))&&(S(i,i.e+B+2,1),e=!i.times(i).eq(u));break}if(!o&&(S(s,s.e+B+2,0),s.times(s).eq(u))){i=s;break}h+=4,c+=4,o=1}return S(i,i.e+B+1,I,e)},D.toExponential=function(e,r){return null!=e&&(o(e,0,y),e++),E(this,e,r,1)},D.toFixed=function(e,r){return null!=e&&(o(e,0,y),e=e+this.e+1),E(this,e,r)},D.toFormat=function(e,r){var n=this.toFixed(e,r);if(this.c){var t,i=n.split("."),o=+k.groupSize,s=+k.secondaryGroupSize,u=k.groupSeparator,f=i[0],c=i[1],l=this.s<0,a=l?f.slice(1):f,h=a.length;if(s&&(t=o,o=s,s=t,h-=t),o>0&&h>0){for(t=h%o||o,f=a.substr(0,t);h>t;t+=o)f+=u+a.substr(t,o);s>0&&(f+=u+a.slice(t)),l&&(f="-"+f)}n=c?f+k.decimalSeparator+((s=+k.fractionGroupSize)?c.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+k.fractionGroupSeparator):c):f}return n},D.toFraction=function(e){var r,n,i,o,s,u,f,c,a,h,g,w,d=this,v=d.c;if(null!=e&&(c=new l(e),!c.isInteger()&&(c.c||1!==c.s)||c.lt(L)))throw Error(p+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+e);if(!v)return d.toString();for(n=new l(L),h=i=new l(L),o=a=new l(L),w=t(v),u=n.e=w.length-d.e-1,n.c[0]=N[(f=u%m)<0?m+f:f],e=!e||c.comparedTo(n)>0?u>0?n:h:c,f=M,M=1/0,c=new l(w),a.c[0]=0;g=R(c,n,0,1),s=i.plus(g.times(o)),1!=s.comparedTo(e);)i=o,o=s,h=a.plus(g.times(s=h)),a=s,n=c.minus(g.times(s=n)),c=s;return s=R(e.minus(i),o,0,1),a=a.plus(s.times(h)),i=i.plus(s.times(o)),a.s=h.s=d.s,u*=2,r=R(h,o,u,I).minus(d).abs().comparedTo(R(a,i,u,I).minus(d).abs())<1?[h.toString(),o.toString()]:[a.toString(),i.toString()],M=f,r},D.toNumber=function(){return+this},D.toPrecision=function(e,r){return null!=e&&o(e,1,y),E(this,e,r,2)},D.toString=function(e){var r,n=this,i=n.s,s=n.e;return null===s?i?(r="Infinity",0>i&&(r="-"+r)):r="NaN":(r=t(n.c),null==e?r=T>=s||s>=U?f(r,s):c(r,s,"0"):(o(e,2,q.length,"Base"),r=P(c(r,s,"0"),10,e,i,!0)),0>i&&n.c[0]&&(r="-"+r)),r},D.valueOf=D.toJSON=function(){var e,r=this,n=r.e;return null===n?r.toString():(e=t(r.c),e=T>=n||n>=U?f(e,n):c(e,n,"0"),r.s<0?"-"+e:e)},D._isBigNumber=!0,null!=e&&l.set(e),l}function n(e){var r=0|e;return e>0||e===r?r:r-1}function t(e){for(var r,n,t=1,i=e.length,o=e[0]+"";i>t;){for(r=e[t++]+"",n=m-r.length;n--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function i(e,r){var n,t,i=e.c,o=r.c,s=e.s,u=r.s,f=e.e,c=r.e;if(!s||!u)return null;if(n=i&&!i[0],t=o&&!o[0],n||t)return n?t?0:-u:s;if(s!=u)return s;if(n=0>s,t=f==c,!i||!o)return t?0:!i^n?1:-1;if(!t)return f>c^n?1:-1;for(u=(f=i.length)<(c=o.length)?f:c,s=0;u>s;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return f==c?0:f>c^n?1:-1}function o(e,r,n,t){if(r>e||e>n||e!==(0>e?h(e):g(e)))throw Error(p+(t||"Argument")+("number"==typeof e?r>e||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+e)}function s(e){return"[object Array]"==Object.prototype.toString.call(e)}function u(e){var r=e.c.length-1;return n(e.e/m)==r&&e.c[r]%2!=0}function f(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>r?"e":"e+")+r}function c(e,r,n){var t,i;if(0>r){for(i=n+".";++r;i+=n);e=i+e}else if(t=e.length,++r>t){for(i=n,r-=t;--r;i+=n);e+=i}else t>r&&(e=e.slice(0,r)+"."+e.slice(r));return e}var l,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,h=Math.ceil,g=Math.floor,p="[BigNumber Error] ",w=p+"Number primitive has more than 15 significant digits: ",d=1e14,m=14,v=9007199254740991,N=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],O=1e7,y=1e9;l=r(),l["default"]=l.BigNumber=l,"function"==typeof define&&define.amd?define(function(){return l}):"undefined"!=typeof module&&module.exports?module.exports=l:(e||(globalScope="undefined"!=typeof self&&self?self:window),e.BigNumber=l)}(this);
/* bignumber.js v7.0.1 https://github.com/MikeMcl/bignumber.js/LICENCE */
!function(e){"use strict";function r(e){function l(e,r){var n,t,i,s,u,f,c,h=this;if(!(h instanceof l))return new l(e,r);if(null==r){if(e instanceof l)return h.s=e.s,h.e=e.e,void(h.c=(e=e.c)?e.slice():e);if(u="number"==typeof e,u&&0*e==0){if(h.s=0>1/e?(e=-e,-1):1,e===~~e){for(i=0,s=e;s>=10;s/=10,i++);return h.e=i,void(h.c=[e])}c=e+""}else{if(!a.test(c=e+""))return _(h,c,u);h.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}}else{if(o(r,2,q.length,"Base"),c=e+"",10==r)return h=new l(e instanceof l?e:c),R(h,B+h.e+1,I);if(u="number"==typeof e){if(0*e!=0)return _(h,c,u,r);if(h.s=0>1/e?(c=c.slice(1),-1):1,l.DEBUG&&c.replace(/^0\.0*|\./,"").length>15)throw Error(w+e);u=!1}else h.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,r>10&&37>r&&(c=c.toLowerCase());for(n=q.slice(0,r),i=s=0,f=c.length;f>s;s++)if(n.indexOf(t=c.charAt(s))<0){if("."==t&&s>i){i=f;continue}return _(h,e+"",u,r)}c=P(c,r,10,h.s)}for((i=c.indexOf("."))>-1&&(c=c.replace(".","")),(s=c.search(/e/i))>0?(0>i&&(i=s),i+=+c.slice(s+1),c=c.substring(0,s)):0>i&&(i=c.length),s=0;48===c.charCodeAt(s);s++);for(f=c.length;48===c.charCodeAt(--f););if(c=c.slice(s,++f)){if(f-=s,u&&l.DEBUG&&f>15&&(e>v||e!==g(e)))throw Error(w+h.s*e);if(i=i-s-1,i>M)h.c=h.e=null;else if(x>i)h.c=[h.e=0];else{if(h.e=i,h.c=[],s=(i+1)%m,0>i&&(s+=m),f>s){for(s&&h.c.push(+c.slice(0,s)),f-=m;f>s;)h.c.push(+c.slice(s,s+=m));c=c.slice(s),s=m-c.length}else s-=f;for(;s--;c+="0");h.c.push(+c)}}else h.c=[h.e=0]}function E(e,r,n,i){var s,u,a,h,g;if(null==n?n=I:o(n,0,8),!e.c)return e.toString();if(s=e.c[0],a=e.e,null==r)g=t(e.c),g=1==i||2==i&&T>=a?f(g,a):c(g,a,"0");else if(e=R(new l(e),r,n),u=e.e,g=t(e.c),h=g.length,1==i||2==i&&(u>=r||T>=u)){for(;r>h;g+="0",h++);g=f(g,u)}else if(r-=a,g=c(g,u,"0"),u+1>h){if(--r>0)for(g+=".";r--;g+="0");}else if(r+=u-h,r>0)for(u+1==h&&(g+=".");r--;g+="0");return e.s<0&&s?"-"+g:g}function b(e,r){var n,t,i=0;for(s(e[0])&&(e=e[0]),n=new l(e[0]);++i<e.length;){if(t=new l(e[i]),!t.s){n=t;break}r.call(n,t)&&(n=t)}return n}function A(e,r,n){for(var t=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,t++);return(n=t+n*m-1)>M?e.c=e.e=null:x>n?e.c=[e.e=0]:(e.e=n,e.c=r),e}function R(e,r,n,t){var i,o,s,u,f,c,l,a=e.c,p=N;if(a){e:{for(i=1,u=a[0];u>=10;u/=10,i++);if(o=r-i,0>o)o+=m,s=r,f=a[c=0],l=f/p[i-s-1]%10|0;else if(c=h((o+1)/m),c>=a.length){if(!t)break e;for(;a.length<=c;a.push(0));f=l=0,i=1,o%=m,s=o-m+1}else{for(f=u=a[c],i=1;u>=10;u/=10,i++);o%=m,s=o-m+i,l=0>s?0:f/p[i-s-1]%10|0}if(t=t||0>r||null!=a[c+1]||(0>s?f:f%p[i-s-1]),t=4>n?(l||t)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||t||6==n&&(o>0?s>0?f/p[i-s]:0:a[c-1])%10&1||n==(e.s<0?8:7)),1>r||!a[0])return a.length=0,t?(r-=e.e+1,a[0]=p[(m-r%m)%m],e.e=-r||0):a[0]=e.e=0,e;if(0==o?(a.length=c,u=1,c--):(a.length=c+1,u=p[m-o],a[c]=s>0?g(f/p[i-s]%p[s])*u:0),t)for(;;){if(0==c){for(o=1,s=a[0];s>=10;s/=10,o++);for(s=a[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,a[0]==d&&(a[0]=1));break}if(a[c]+=u,a[c]!=d)break;a[c--]=0,u=1}for(o=a.length;0===a[--o];a.pop());}e.e>M?e.c=e.e=null:e.e<x&&(e.c=[e.e=0])}return e}var S,P,_,D=l.prototype={constructor:l,toString:null,valueOf:null},L=new l(1),B=20,I=4,T=-7,U=21,x=-1e7,M=1e7,C=!1,G=1,F=0,k={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},q="0123456789abcdefghijklmnopqrstuvwxyz";return l.clone=r,l.ROUND_UP=0,l.ROUND_DOWN=1,l.ROUND_CEIL=2,l.ROUND_FLOOR=3,l.ROUND_HALF_UP=4,l.ROUND_HALF_DOWN=5,l.ROUND_HALF_EVEN=6,l.ROUND_HALF_CEIL=7,l.ROUND_HALF_FLOOR=8,l.EUCLID=9,l.config=l.set=function(e){var r,n;if(null!=e){if("object"!=typeof e)throw Error(p+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(n=e[r],o(n,0,y,r),B=n),e.hasOwnProperty(r="ROUNDING_MODE")&&(n=e[r],o(n,0,8,r),I=n),e.hasOwnProperty(r="EXPONENTIAL_AT")&&(n=e[r],s(n)?(o(n[0],-y,0,r),o(n[1],0,y,r),T=n[0],U=n[1]):(o(n,-y,y,r),T=-(U=0>n?-n:n))),e.hasOwnProperty(r="RANGE"))if(n=e[r],s(n))o(n[0],-y,-1,r),o(n[1],1,y,r),x=n[0],M=n[1];else{if(o(n,-y,y,r),!n)throw Error(p+r+" cannot be zero: "+n);x=-(M=0>n?-n:n)}if(e.hasOwnProperty(r="CRYPTO")){if(n=e[r],n!==!!n)throw Error(p+r+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw C=!n,Error(p+"crypto unavailable");C=n}else C=n}if(e.hasOwnProperty(r="MODULO_MODE")&&(n=e[r],o(n,0,9,r),G=n),e.hasOwnProperty(r="POW_PRECISION")&&(n=e[r],o(n,0,y,r),F=n),e.hasOwnProperty(r="FORMAT")){if(n=e[r],"object"!=typeof n)throw Error(p+r+" not an object: "+n);k=n}if(e.hasOwnProperty(r="ALPHABET")){if(n=e[r],"string"!=typeof n||/^.$|\.|(.).*\1/.test(n))throw Error(p+r+" invalid: "+n);q=n}}return{DECIMAL_PLACES:B,ROUNDING_MODE:I,EXPONENTIAL_AT:[T,U],RANGE:[x,M],CRYPTO:C,MODULO_MODE:G,POW_PRECISION:F,FORMAT:k,ALPHABET:q}},l.isBigNumber=function(e){return e instanceof l||e&&e._isBigNumber===!0||!1},l.maximum=l.max=function(){return b(arguments,D.lt)},l.minimum=l.min=function(){return b(arguments,D.gt)},l.random=function(){var e=9007199254740992,r=Math.random()*e&2097151?function(){return g(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var n,t,i,s,u,f=0,c=[],a=new l(L);if(null==e?e=B:o(e,0,y),s=h(e/m),C)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));s>f;)u=131072*n[f]+(n[f+1]>>>11),u>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),n[f]=t[0],n[f+1]=t[1]):(c.push(u%1e14),f+=2);f=s/2}else{if(!crypto.randomBytes)throw C=!1,Error(p+"crypto unavailable");for(n=crypto.randomBytes(s*=7);s>f;)u=281474976710656*(31&n[f])+1099511627776*n[f+1]+4294967296*n[f+2]+16777216*n[f+3]+(n[f+4]<<16)+(n[f+5]<<8)+n[f+6],u>=9e15?crypto.randomBytes(7).copy(n,f):(c.push(u%1e14),f+=7);f=s/7}if(!C)for(;s>f;)u=r(),9e15>u&&(c[f++]=u%1e14);for(s=c[--f],e%=m,s&&e&&(u=N[m-e],c[f]=g(s/u)*u);0===c[f];c.pop(),f--);if(0>f)c=[i=0];else{for(i=-1;0===c[0];c.splice(0,1),i-=m);for(f=1,u=c[0];u>=10;u/=10,f++);m>f&&(i-=m-f)}return a.e=i,a.c=c,a}}(),P=function(){function e(e,r,n,t){for(var i,o,s=[0],u=0,f=e.length;f>u;){for(o=s.length;o--;s[o]*=r);for(s[0]+=t.indexOf(e.charAt(u++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}var r="0123456789";return function(n,i,o,s,u){var f,a,h,g,p,w,d,m,v=n.indexOf("."),N=B,O=I;for(v>=0&&(g=F,F=0,n=n.replace(".",""),m=new l(i),w=m.pow(n.length-v),F=g,m.c=e(c(t(w.c),w.e,"0"),10,o,r),m.e=m.c.length),d=e(n,i,o,u?(f=q,r):(f=r,q)),h=g=d.length;0==d[--g];d.pop());if(!d[0])return f.charAt(0);if(0>v?--h:(w.c=d,w.e=h,w.s=s,w=S(w,m,N,O,o),d=w.c,p=w.r,h=w.e),a=h+N+1,v=d[a],g=o/2,p=p||0>a||null!=d[a+1],p=4>O?(null!=v||p)&&(0==O||O==(w.s<0?3:2)):v>g||v==g&&(4==O||p||6==O&&1&d[a-1]||O==(w.s<0?8:7)),1>a||!d[0])n=p?c(f.charAt(1),-N,f.charAt(0)):f.charAt(0);else{if(d.length=a,p)for(--o;++d[--a]>o;)d[a]=0,a||(++h,d=[1].concat(d));for(g=d.length;!d[--g];);for(v=0,n="";g>=v;n+=f.charAt(d[v++]));n=c(n,h,f.charAt(0))}return n}}(),S=function(){function e(e,r,n){var t,i,o,s,u=0,f=e.length,c=r%O,l=r/O|0;for(e=e.slice();f--;)o=e[f]%O,s=e[f]/O|0,t=l*o+s*c,i=c*o+t%O*O+u,u=(i/n|0)+(t/O|0)+l*s,e[f]=i%n;return u&&(e=[u].concat(e)),e}function r(e,r,n,t){var i,o;if(n!=t)o=n>t?1:-1;else for(i=o=0;n>i;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function t(e,r,n,t){for(var i=0;n--;)e[n]-=i,i=e[n]<r[n]?1:0,e[n]=i*t+e[n]-r[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,o,s,u,f){var c,a,h,p,w,v,N,O,y,E,b,A,S,P,_,D,L,B=i.s==o.s?1:-1,I=i.c,T=o.c;if(!(I&&I[0]&&T&&T[0]))return new l(i.s&&o.s&&(I?!T||I[0]!=T[0]:T)?I&&0==I[0]||!T?0*B:B/0:NaN);for(O=new l(B),y=O.c=[],a=i.e-o.e,B=s+a+1,f||(f=d,a=n(i.e/m)-n(o.e/m),B=B/m|0),h=0;T[h]==(I[h]||0);h++);if(T[h]>(I[h]||0)&&a--,0>B)y.push(1),p=!0;else{for(P=I.length,D=T.length,h=0,B+=2,w=g(f/(T[0]+1)),w>1&&(T=e(T,w,f),I=e(I,w,f),D=T.length,P=I.length),S=D,E=I.slice(0,D),b=E.length;D>b;E[b++]=0);L=T.slice(),L=[0].concat(L),_=T[0],T[1]>=f/2&&_++;do{if(w=0,c=r(T,E,D,b),0>c){if(A=E[0],D!=b&&(A=A*f+(E[1]||0)),w=g(A/_),w>1)for(w>=f&&(w=f-1),v=e(T,w,f),N=v.length,b=E.length;1==r(v,E,N,b);)w--,t(v,N>D?L:T,N,f),N=v.length,c=1;else 0==w&&(c=w=1),v=T.slice(),N=v.length;if(b>N&&(v=[0].concat(v)),t(E,v,b,f),b=E.length,-1==c)for(;r(T,E,D,b)<1;)w++,t(E,b>D?L:T,b,f),b=E.length}else 0===c&&(w++,E=[0]);y[h++]=w,E[0]?E[b++]=I[S]||0:(E=[I[S]],b=1)}while((S++<P||null!=E[0])&&B--);p=null!=E[0],y[0]||y.splice(0,1)}if(f==d){for(h=1,B=y[0];B>=10;B/=10,h++);R(O,s+(O.e=h+a*m-1)+1,u,p)}else O.e=a,O.r=+p;return O}}(),_=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,r=/^([^.]+)\.$/,n=/^\.([^.]+)$/,t=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,s,u,f){var c,a=u?s:s.replace(i,"");if(t.test(a))o.s=isNaN(a)?null:0>a?-1:1,o.c=o.e=null;else{if(!u&&(a=a.replace(e,function(e,r,n){return c="x"==(n=n.toLowerCase())?16:"b"==n?2:8,f&&f!=c?e:r}),f&&(c=f,a=a.replace(r,"$1").replace(n,"0.$1")),s!=a))return new l(a,c);if(l.DEBUG)throw Error(p+"Not a"+(f?" base "+f:"")+" number: "+s);o.c=o.e=o.s=null}}}(),D.absoluteValue=D.abs=function(){var e=new l(this);return e.s<0&&(e.s=1),e},D.comparedTo=function(e,r){return i(this,new l(e,r))},D.decimalPlaces=D.dp=function(e,r){var t,i,s,u=this;if(null!=e)return o(e,0,y),null==r?r=I:o(r,0,8),R(new l(u),e+u.e+1,r);if(!(t=u.c))return null;if(i=((s=t.length-1)-n(this.e/m))*m,s=t[s])for(;s%10==0;s/=10,i--);return 0>i&&(i=0),i},D.dividedBy=D.div=function(e,r){return S(this,new l(e,r),B,I)},D.dividedToIntegerBy=D.idiv=function(e,r){return S(this,new l(e,r),0,1)},D.exponentiatedBy=D.pow=function(e,r){var n,t,i,o,s,f,c,a,w=this;if(e=new l(e),e.c&&!e.isInteger())throw Error(p+"Exponent not an integer: "+e);if(null!=r&&(r=new l(r)),s=e.e>14,!w.c||!w.c[0]||1==w.c[0]&&!w.e&&1==w.c.length||!e.c||!e.c[0])return a=new l(Math.pow(+w.valueOf(),s?2-u(e):+e)),r?a.mod(r):a;if(f=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new l(NaN);t=!f&&w.isInteger()&&r.isInteger(),t&&(w=w.mod(r))}else{if(e.e>9&&(w.e>0||w.e<-1||(0==w.e?w.c[0]>1||s&&w.c[1]>=24e7:w.c[0]<8e13||s&&w.c[0]<=9999975e7)))return i=w.s<0&&u(e)?-0:0,w.e>-1&&(i=1/i),new l(f?1/i:i);F&&(i=h(F/m+2))}for(s?(n=new l(.5),c=u(e)):c=e%2,f&&(e.s=1),a=new l(L);;){if(c){if(a=a.times(w),!a.c)break;i?a.c.length>i&&(a.c.length=i):t&&(a=a.mod(r))}if(s){if(e=e.times(n),R(e,e.e+1,1),!e.c[0])break;s=e.e>14,c=u(e)}else{if(e=g(e/2),!e)break;c=e%2}w=w.times(w),i?w.c&&w.c.length>i&&(w.c.length=i):t&&(w=w.mod(r))}return t?a:(f&&(a=L.div(a)),r?a.mod(r):i?R(a,F,I,o):a)},D.integerValue=function(e){var r=new l(this);return null==e?e=I:o(e,0,8),R(r,r.e+1,e)},D.isEqualTo=D.eq=function(e,r){return 0===i(this,new l(e,r))},D.isFinite=function(){return!!this.c},D.isGreaterThan=D.gt=function(e,r){return i(this,new l(e,r))>0},D.isGreaterThanOrEqualTo=D.gte=function(e,r){return 1===(r=i(this,new l(e,r)))||0===r},D.isInteger=function(){return!!this.c&&n(this.e/m)>this.c.length-2},D.isLessThan=D.lt=function(e,r){return i(this,new l(e,r))<0},D.isLessThanOrEqualTo=D.lte=function(e,r){return-1===(r=i(this,new l(e,r)))||0===r},D.isNaN=function(){return!this.s},D.isNegative=function(){return this.s<0},D.isPositive=function(){return this.s>0},D.isZero=function(){return!!this.c&&0==this.c[0]},D.minus=function(e,r){var t,i,o,s,u=this,f=u.s;if(e=new l(e,r),r=e.s,!f||!r)return new l(NaN);if(f!=r)return e.s=-r,u.plus(e);var c=u.e/m,a=e.e/m,h=u.c,g=e.c;if(!c||!a){if(!h||!g)return h?(e.s=-r,e):new l(g?u:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-r,e):new l(h[0]?u:3==I?-0:0)}if(c=n(c),a=n(a),h=h.slice(),f=c-a){for((s=0>f)?(f=-f,o=h):(a=c,o=g),o.reverse(),r=f;r--;o.push(0));o.reverse()}else for(i=(s=(f=h.length)<(r=g.length))?f:r,f=r=0;i>r;r++)if(h[r]!=g[r]){s=h[r]<g[r];break}if(s&&(o=h,h=g,g=o,e.s=-e.s),r=(i=g.length)-(t=h.length),r>0)for(;r--;h[t++]=0);for(r=d-1;i>f;){if(h[--i]<g[i]){for(t=i;t&&!h[--t];h[t]=r);--h[t],h[i]+=d}h[i]-=g[i]}for(;0==h[0];h.splice(0,1),--a);return h[0]?A(e,h,a):(e.s=3==I?-1:1,e.c=[e.e=0],e)},D.modulo=D.mod=function(e,r){var n,t,i=this;return e=new l(e,r),!i.c||!e.s||e.c&&!e.c[0]?new l(NaN):!e.c||i.c&&!i.c[0]?new l(i):(9==G?(t=e.s,e.s=1,n=S(i,e,0,3),e.s=t,n.s*=t):n=S(i,e,0,G),e=i.minus(n.times(e)),e.c[0]||1!=G||(e.s=i.s),e)},D.multipliedBy=D.times=function(e,r){var t,i,o,s,u,f,c,a,h,g,p,w,v,N,y,E=this,b=E.c,R=(e=new l(e,r)).c;if(!(b&&R&&b[0]&&R[0]))return!E.s||!e.s||b&&!b[0]&&!R||R&&!R[0]&&!b?e.c=e.e=e.s=null:(e.s*=E.s,b&&R?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=n(E.e/m)+n(e.e/m),e.s*=E.s,c=b.length,g=R.length,g>c&&(v=b,b=R,R=v,o=c,c=g,g=o),o=c+g,v=[];o--;v.push(0));for(N=d,y=O,o=g;--o>=0;){for(t=0,p=R[o]%y,w=R[o]/y|0,u=c,s=o+u;s>o;)a=b[--u]%y,h=b[u]/y|0,f=w*a+h*p,a=p*a+f%y*y+v[s]+t,t=(a/N|0)+(f/y|0)+w*h,v[s--]=a%N;v[s]=t}return t?++i:v.splice(0,1),A(e,v,i)},D.negated=function(){var e=new l(this);return e.s=-e.s||null,e},D.plus=function(e,r){var t,i=this,o=i.s;if(e=new l(e,r),r=e.s,!o||!r)return new l(NaN);if(o!=r)return e.s=-r,i.minus(e);var s=i.e/m,u=e.e/m,f=i.c,c=e.c;if(!s||!u){if(!f||!c)return new l(o/0);if(!f[0]||!c[0])return c[0]?e:new l(f[0]?i:0*o)}if(s=n(s),u=n(u),f=f.slice(),o=s-u){for(o>0?(u=s,t=c):(o=-o,t=f),t.reverse();o--;t.push(0));t.reverse()}for(o=f.length,r=c.length,0>o-r&&(t=c,c=f,f=t,r=o),o=0;r;)o=(f[--r]=f[r]+c[r]+o)/d|0,f[r]=d===f[r]?0:f[r]%d;return o&&(f=[o].concat(f),++u),A(e,f,u)},D.precision=D.sd=function(e,r){var n,t,i,s=this;if(null!=e&&e!==!!e)return o(e,1,y),null==r?r=I:o(r,0,8),R(new l(s),e,r);if(!(n=s.c))return null;if(i=n.length-1,t=i*m+1,i=n[i]){for(;i%10==0;i/=10,t--);for(i=n[0];i>=10;i/=10,t++);}return e&&s.e+1>t&&(t=s.e+1),t},D.shiftedBy=function(e){return o(e,-v,v),this.times("1e"+e)},D.squareRoot=D.sqrt=function(){var e,r,i,o,s,u=this,f=u.c,c=u.s,a=u.e,h=B+4,g=new l("0.5");if(1!==c||!f||!f[0])return new l(!c||0>c&&(!f||f[0])?NaN:f?u:1/0);if(c=Math.sqrt(+u),0==c||c==1/0?(r=t(f),(r.length+a)%2==0&&(r+="0"),c=Math.sqrt(r),a=n((a+1)/2)-(0>a||a%2),c==1/0?r="1e"+a:(r=c.toExponential(),r=r.slice(0,r.indexOf("e")+1)+a),i=new l(r)):i=new l(c+""),i.c[0])for(a=i.e,c=a+h,3>c&&(c=0);;)if(s=i,i=g.times(s.plus(S(u,s,h,1))),t(s.c).slice(0,c)===(r=t(i.c)).slice(0,c)){if(i.e<a&&--c,r=r.slice(c-3,c+1),"9999"!=r&&(o||"4999"!=r)){(!+r||!+r.slice(1)&&"5"==r.charAt(0))&&(R(i,i.e+B+2,1),e=!i.times(i).eq(u));break}if(!o&&(R(s,s.e+B+2,0),s.times(s).eq(u))){i=s;break}h+=4,c+=4,o=1}return R(i,i.e+B+1,I,e)},D.toExponential=function(e,r){return null!=e&&(o(e,0,y),e++),E(this,e,r,1)},D.toFixed=function(e,r){return null!=e&&(o(e,0,y),e=e+this.e+1),E(this,e,r)},D.toFormat=function(e,r){var n=this.toFixed(e,r);if(this.c){var t,i=n.split("."),o=+k.groupSize,s=+k.secondaryGroupSize,u=k.groupSeparator,f=i[0],c=i[1],l=this.s<0,a=l?f.slice(1):f,h=a.length;if(s&&(t=o,o=s,s=t,h-=t),o>0&&h>0){for(t=h%o||o,f=a.substr(0,t);h>t;t+=o)f+=u+a.substr(t,o);s>0&&(f+=u+a.slice(t)),l&&(f="-"+f)}n=c?f+k.decimalSeparator+((s=+k.fractionGroupSize)?c.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+k.fractionGroupSeparator):c):f}return n},D.toFraction=function(e){var r,n,i,o,s,u,f,c,a,h,g,w,d=this,v=d.c;if(null!=e&&(c=new l(e),!c.isInteger()&&(c.c||1!==c.s)||c.lt(L)))throw Error(p+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+e);if(!v)return d.toString();for(n=new l(L),h=i=new l(L),o=a=new l(L),w=t(v),u=n.e=w.length-d.e-1,n.c[0]=N[(f=u%m)<0?m+f:f],e=!e||c.comparedTo(n)>0?u>0?n:h:c,f=M,M=1/0,c=new l(w),a.c[0]=0;g=S(c,n,0,1),s=i.plus(g.times(o)),1!=s.comparedTo(e);)i=o,o=s,h=a.plus(g.times(s=h)),a=s,n=c.minus(g.times(s=n)),c=s;return s=S(e.minus(i),o,0,1),a=a.plus(s.times(h)),i=i.plus(s.times(o)),a.s=h.s=d.s,u*=2,r=S(h,o,u,I).minus(d).abs().comparedTo(S(a,i,u,I).minus(d).abs())<1?[h.toString(),o.toString()]:[a.toString(),i.toString()],M=f,r},D.toNumber=function(){return+this},D.toPrecision=function(e,r){return null!=e&&o(e,1,y),E(this,e,r,2)},D.toString=function(e){var r,n=this,i=n.s,s=n.e;return null===s?i?(r="Infinity",0>i&&(r="-"+r)):r="NaN":(r=t(n.c),null==e?r=T>=s||s>=U?f(r,s):c(r,s,"0"):(o(e,2,q.length,"Base"),r=P(c(r,s,"0"),10,e,i,!0)),0>i&&n.c[0]&&(r="-"+r)),r},D.valueOf=D.toJSON=function(){var e,r=this,n=r.e;return null===n?r.toString():(e=t(r.c),e=T>=n||n>=U?f(e,n):c(e,n,"0"),r.s<0?"-"+e:e)},D._isBigNumber=!0,null!=e&&l.set(e),l}function n(e){var r=0|e;return e>0||e===r?r:r-1}function t(e){for(var r,n,t=1,i=e.length,o=e[0]+"";i>t;){for(r=e[t++]+"",n=m-r.length;n--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function i(e,r){var n,t,i=e.c,o=r.c,s=e.s,u=r.s,f=e.e,c=r.e;if(!s||!u)return null;if(n=i&&!i[0],t=o&&!o[0],n||t)return n?t?0:-u:s;if(s!=u)return s;if(n=0>s,t=f==c,!i||!o)return t?0:!i^n?1:-1;if(!t)return f>c^n?1:-1;for(u=(f=i.length)<(c=o.length)?f:c,s=0;u>s;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return f==c?0:f>c^n?1:-1}function o(e,r,n,t){if(r>e||e>n||e!==(0>e?h(e):g(e)))throw Error(p+(t||"Argument")+("number"==typeof e?r>e||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+e)}function s(e){return"[object Array]"==Object.prototype.toString.call(e)}function u(e){var r=e.c.length-1;return n(e.e/m)==r&&e.c[r]%2!=0}function f(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>r?"e":"e+")+r}function c(e,r,n){var t,i;if(0>r){for(i=n+".";++r;i+=n);e=i+e}else if(t=e.length,++r>t){for(i=n,r-=t;--r;i+=n);e+=i}else t>r&&(e=e.slice(0,r)+"."+e.slice(r));return e}var l,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,h=Math.ceil,g=Math.floor,p="[BigNumber Error] ",w=p+"Number primitive has more than 15 significant digits: ",d=1e14,m=14,v=9007199254740991,N=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],O=1e7,y=1e9;l=r(),l["default"]=l.BigNumber=l,"function"==typeof define&&define.amd?define(function(){return l}):"undefined"!=typeof module&&module.exports?module.exports=l:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=l)}(this);
//# sourceMappingURL=bignumber.js.map
{
"name": "bignumber.js",
"main": "bignumber.js",
"version": "7.0.0",
"version": "7.0.1",
"homepage": "https://github.com/MikeMcl/bignumber.js",

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

@@ -0,1 +1,5 @@

#### 7.0.1
* 26/04/2018
* #158 Fix global object variable name typo.
#### 7.0.0

@@ -2,0 +6,0 @@ * 26/04/2018

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

@@ -35,4 +35,4 @@ "arbitrary",

"test": "node test/test",
"build": "uglifyjs bignumber.js --source-map bignumber.js.map -c -m -o bignumber.min.js --preamble \"/* bignumber.js v7.0.0 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 v7.0.1 https://github.com/MikeMcl/bignumber.js/LICENCE */\""
}
}

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