2016-02-20 22:21:48 +00:00
|
|
|
!function(n){"use strict";function e(n){var e,i,t,r=n.length-1,s="",o=n[0];if(r>0){for(s+=o,e=1;r>e;e++)t=n[e]+"",i=Sn-t.length,i&&(s+=l(i)),s+=t;o=n[e],t=o+"",i=Sn-t.length,i&&(s+=l(i))}else if(0===o)return"0";for(;o%10===0;)o/=10;return s+o}function i(n,e,i){if(n!==~~n||e>n||n>i)throw Error(yn+n)}function t(n,e,i,t){var r,s,o,u;for(s=n[0];s>=10;s/=10)--e;return--e<0?(e+=Sn,r=0):(r=Math.ceil((e+1)/Sn),e%=Sn),s=qn(10,Sn-e),u=n[r]%s|0,null==t?3>e?(0==e?u=u/100|0:1==e&&(u=u/10|0),o=4>i&&99999==u||i>3&&49999==u||5e4==u||0==u):o=(4>i&&u+1==s||i>3&&u+1==s/2)&&(n[r+1]/s/100|0)==qn(10,e-2)-1||(u==s/2||0==u)&&0==(n[r+1]/s/100|0):4>e?(0==e?u=u/1e3|0:1==e?u=u/100|0:2==e&&(u=u/10|0),o=(t||4>i)&&9999==u||!t&&i>3&&4999==u):o=((t||4>i)&&u+1==s||!t&&i>3&&u+1==s/2)&&(n[r+1]/s/1e3|0)==qn(10,e-3)-1,o}function r(n,e,i){for(var t,r,s=[0],o=0,u=n.length;u>o;){for(r=s.length;r--;)s[r]*=e;for(s[0]+=mn.indexOf(n.charAt(o++)),t=0;t<s.length;t++)s[t]>i-1&&(void 0===s[t+1]&&(s[t+1]=0),s[t+1]+=s[t]/i|0,s[t]%=i)}return s.reverse()}function s(n,e){var i,t,r=e.d.length;32>r?(i=Math.ceil(r/3),t=Math.pow(4,-i).toString()):(i=16,t="2.3283064365386962890625e-10"),n.precision+=i,e=E(n,1,e.times(t),new n(1));for(var s=i;s--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return n.precision-=i,e}function o(n,e,i,t){var r,s,o,u,c,f,h,a,l,d=n.constructor;n:if(null!=e){if(a=n.d,!a)return n;for(r=1,u=a[0];u>=10;u/=10)r++;if(s=e-r,0>s)s+=Sn,o=e,h=a[l=0],c=h/qn(10,r-o-1)%10|0;else if(l=Math.ceil((s+1)/Sn),u=a.length,l>=u){if(!t)break n;for(;u++<=l;)a.push(0);h=c=0,r=1,s%=Sn,o=s-Sn+1}else{for(h=u=a[l],r=1;u>=10;u/=10)r++;s%=Sn,o=s-Sn+r,c=0>o?0:h/qn(10,r-o-1)%10|0}if(t=t||0>e||void 0!==a[l+1]||(0>o?h:h%qn(10,r-o-1)),f=4>i?(c||t)&&(0==i||i==(n.s<0?3:2)):c>5||5==c&&(4==i||t||6==i&&(s>0?o>0?h/qn(10,r-o):0:a[l-1])%10&1||i==(n.s<0?8:7)),1>e||!a[0])return a.length=0,f?(e-=n.e+1,a[0]=qn(10,(Sn-e%Sn)%Sn),n.e=-e||0):a[0]=n.e=0,n;if(0==s?(a.length=l,u=1,l--):(a.length=l+1,u=qn(10,Sn-s),a[l]=o>0?(h/qn(10,r-o)%qn(10,o)|0)*u:0),f)for(;;){if(0==l){for(s=1,o=a[0];o>=10;o/=10)s++;for(o=a[0]+=u,u=1;o>=10;o/=10)u++;s!=u&&(n.e++,a[0]==Rn&&(a[0]=1));break}if(a[l]+=u,a[l]!=Rn)break;a[l--]=0,u=1}for(s=a.length;0===a[--s];)a.pop()}return En&&(n.e>d.maxE?(n.d=null,n.e=NaN):n.e<d.minE&&(n.e=0,n.d=[0])),n}function u(n,i,t){if(!n.isFinite())return v(n);var r,s=n.e,o=e(n.d),u=o.length;return i?(t&&(r=t-u)>0?o=o.charAt(0)+"."+o.slice(1)+l(r):u>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(n.e<0?"e":"e+")+n.e):0>s?(o="0."+l(-s-1)+o,t&&(r=t-u)>0&&(o+=l(r))):s>=u?(o+=l(s+1-u),t&&(r=t-s-1)>0&&(o=o+"."+l(r))):((r=s+1)<u&&(o=o.slice(0,r)+"."+o.slice(r)),t&&(r=t-u)>0&&(s+1===u&&(o+="."),o+=l(r))),o}function c(n,e){for(var i=1,t=n[0];t>=10;t/=10)i++;return i+e*Sn-1}function f(n,e,i){if(e>Un)throw En=!0,i&&(n.precision=i),Error(An);return o(new n(vn),e,1,!0)}function h(n,e,i){if(e>_n)throw Error(An);return o(new n(Nn),e,i,!0)}function a(n){var e=n.length-1,i=e*Sn+1;if(e=n[e]){for(;e%10==0;e/=10)i--;for(e=n[0];e>=10;e/=10)i++}return i}function l(n){for(var e="";n--;)e+="0";return e}function d(n,e,i,t){var r,s=new n(1),o=Math.ceil(t/Sn+4);for(En=!1;;){if(i%2&&(s=s.times(e),A(s.d,o)&&(r=!0)),i=On(i/2),0===i){i=s.d.length-1,r&&0===s.d[i]&&++s.d[i];break}e=e.times(e),A(e.d,o)}return En=!0,s}function g(n){return 1&n.d[n.d.length-1]}function p(n,e,i){for(var t,r=new n(e[0]),s=0;++s<e.length;){if(t=new n(e[s]),!t.s){r=t;break}r[i](t)&&(r=t)}return r}function w(n,i){var r,s,u,c,f,h,a,l=0,d=0,g=0,p=n.constructor,w=p.rounding,m=p.precision;if(!n.d||!n.d[0]||n.e>17)return new p(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(null==i?(En=!1,a=m):a=i,h=new p(.03125);n.e>-2;)n=n.times(h),g+=5;for(s=Math.log(qn(2,g))/Math.LN10*2+5|0,a+=s,r=c=f=new p(1),p.precision=a;;){if(c=o(c.times(n),a,1),r=r.times(++d),h=f.plus(Tn(c,r,a,1)),e(h.d).slice(0,a)===e(f.d).slice(0,a)){for(u=g;u--;)f=o(f.times(f),a,1);if(null!=i)return p.precision=m,f;if(!(3>l&&t(f.d,a-s,w,l)))return o(f,p.precision=m,w,En=!0);p.precision=a+=10,r=c=h=new p(1),d=0,l++}f=h}}function m(n,i){var r,s,u,c,h,a,l,d,g,p,w,v=1,N=10,x=n,b=x.d,E=x.constructor,M=E
|