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

4

bignumber.min.js

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

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

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

@@ -0,1 +1,13 @@

#### 7.0.0
* 26/04/2018
* #143 Remove global BigNumber from typings.
* #144 Enable compatibility with `Object.freeze(Object.prototype)`.
* #148 #123 #11 Only throw on a number primitive with more than 15 significant digits if `BigNumber.DEBUG` is `true`.
* Only throw on an invalid BigNumber value if `BigNumber.DEBUG` is `true`. Return BigNumber `NaN` instead.
* #154 `exponentiatedBy`: allow BigNumber exponent.
* #156 Prevent Content Security Policy *unsafe-eval* issue.
* `toFraction`: allow `Infinity` maximum denominator.
* Comment-out some excess tests to reduce test time.
* Amend indentation and other spacing.
#### 6.0.0

@@ -2,0 +14,0 @@ * 26/01/2018

{
"name": "bignumber.js",
"description": "A library for arbitrary-precision decimal and non-decimal arithmetic",
"version": "6.0.0",
"version": "7.0.0",
"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 v6.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.0 https://github.com/MikeMcl/bignumber.js/LICENCE */\""
}
}

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

- Integers and decimals
- Simple API but full-featured
- Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal
- 8 KB minified and gzipped
- Simple API but full-featured
- Works with numbers with or without fraction digits in bases from 2 to 64 inclusive
- Replicates the `toExponential`, `toFixed`, `toPrecision` and `toString` methods of JavaScript's Number type

@@ -73,3 +73,3 @@ - Includes a `toFraction` and a correctly-rounded `squareRoot` method

It accepts a value of type number *(up to 15 significant digits only)*, string or BigNumber object,
It accepts a value of type number, string or BigNumber object,

@@ -83,3 +83,3 @@ ```javascript

and a base from 2 to 36 inclusive can be specified.
and a base from 2 to 36 can be specified (higher bases can be used if a custom alphabet is provided).

@@ -115,3 +115,3 @@ ```javascript

Like JavaScript's number type, there are `toExponential`, `toFixed` and `toPrecision` methods
Like JavaScript's Number type, there are `toExponential`, `toFixed` and `toPrecision` methods

@@ -118,0 +118,0 @@ ```javascript

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

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

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