-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy.js
3 lines (3 loc) · 5.12 KB
/
copy.js
1
2
3
function type(t){return typeof t}function int(t,a=10){return parseInt(String(t),a)}function float(t){return parseFloat(String(t))}function str(t){return String(t)}function len(t){return t.length}function range(...t){let a,r,n;1==t.length?[a,r,n]=[0,t[0],1]:2==t.length?[a,r,n]=[t[0],t[1],1]:[a,r,n]=[t[0],t[1],t[2]];let e=[];if(n>0)for(let t=a;t<r;t+=n)e.push(t);else for(let t=r;t>a;t-=n)e.push(t);return e}function round(t,a){return Math.round(t*10**a)/10**a}function chr(t){return String.fromCharCode(t)}function ord(t){return t.charCodeAt(0)}function print(...t){console.log(...t)}function abs(t){return Math.abs(t)}function all(t){return!t.includes(!1)}function bool(t){t.length}function pow(t,a){return t**a}function min(...t){return"object"==typeof t[0]?Math.min(...t[0]):Math.min(...t)}function max(...t){return"object"==typeof t[0]?Math.max(...t[0]):Math.max(...t)}class random{static random(){return Math.random()}static randint(t,a){return t=Math.ceil(t),a=Math.floor(a),Math.floor(Math.random()*(a-t+1))+t}static choice(t){return t[Math.ceil(Math.random()*t.length)-1]}static shuffle(t){let a=!1,r=t.length;"string"==typeof t&&(t=t.split(""),a=!0);let n=[];for(let a=0;a<r;a++)n.push(t.splice(Math.ceil(Math.random()*t.length)-1,1)[0]);return a?n.join(""):n}}String.prototype.join=function(t){return t.join(this)};const True=!0,False=!1;class math{static acos(...t){Math.acos(...t)}static acosh(...t){Math.acosh(...t)}static asin(...t){Math.asin(...t)}static asinh(...t){Math.asinh(...t)}static atan(...t){Math.atan(...t)}static atan2(...t){Math.atan2(...t)}static atanh(...t){Math.atanh(...t)}static ceil(...t){Math.ceil(...t)}static comb(...t){Math.comb(...t)}static copysign(...t){Math.copysign(...t)}static cos(...t){Math.cos(...t)}static cosh(...t){Math.cosh(...t)}static degrees(t){return t*(180/Math.PI)}static dist(t,a){1==t.length&&t.push(t[0]),1==a.length&&a.push(t[0]);let r=t[0],n=a[0],e=t[1],i=a[1];return Math.sqrt(Math.pow(r-n,2)+Math.pow(e-i,2))}static erf(t){var a=.254829592,r=-.284496736,n=1.421413741,e=-1.453152027,i=1.061405429,s=.3275911,h=1;t<0&&(h=-1),t=Math.abs(t);var o=1/(1+s*t),c=1-((((i*o+e)*o+n)*o+r)*o+a)*o*Math.exp(-t*t);return h*c}static erfc(t){let a,r=0x473e1eff78468,n=-1.135203980240205,e=.001341267915016756,i=-3.722078785823172e-9,s=.254829592,h=1.135203980240205,o=Math.abs(t);if(o<1)a=1-o/(s+h*o);else{let t=Math.exp(-o*o);a=(r+n*o)*t/(1+e*o+i*o*o)}return t<0?1+2*a:1-2*a}static exp(t){return Math.E**t}static expm1(t){return Math.E**t-1}static fabs(t){return 1*Math.abs(t)}static factorial(t){let a=1,r=1;for(;r<=t;r++)a*=r;return a}static floor(...t){Math.floor(...t)}static fmod(t,a){return t%a*1}static frexp(t){if(0===t)return[t,0];var a=new DataView(new ArrayBuffer(8));a.setFloat64(0,t);var r=a.getUint32(0)>>>20&2047;0===r&&(a.setFloat64(0,t*Math.pow(2,64)),r=(a.getUint32(0)>>>20&2047)-64);var n=r-1022,e=ldexp(t,-n);return[e,n]}static fsum(t){let a=0;for(let r in t)a+=1;return a}static gamma(t){let a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],r=7;if(t<.5)return Math.PI/(Math.sin(Math.PI*t)*this.gamma(1-t));t-=1;let n=a[0],e=t+r+.5;for(let r=1;r<a.length;r++)n+=a[r]/(t+r);return Math.sqrt(2*Math.PI)*Math.pow(e,t+.5)*Math.exp(-e)*n}static gcd(t,a){for(;0!=a;)[t,a]=[a,t%a];return t}static hypot(...t){Math.hypot(...t)}static isClose(t,a,r=1e-9,n=0){if(isNaN(t)||isNaN(a))return!1;if(t===a)return!0;if(!1===isFinite(t)||!1===isFinite(a))return Math.sign(t)===Math.sign(a);if(r>0){const e=Math.abs(t-a);return e<=Math.abs(t*r)||e<=n}return Math.abs(t-a)<=n}static isfinite(t){return t!=1/0}static isinf(t){return t==1/0}static isnan(...t){isNaN(...t)}static isqrt(t){return Math.floor(t**.5)}static ldexp(t,a){for(var r=Math.min(3,Math.ceil(Math.abs(a)/1023)),n=t,e=0;e<r;e++)n*=Math.pow(2,Math.floor((a+e)/r));return n}static lgamma(t){let a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],r=7;if(x<.5)return Math.PI/(Math.sin(Math.PI*x)*this.gamma(1-x));x-=1;let n=a[0],e=x+r+.5;for(let t=1;t<a.length;t++)n+=a[t]/(x+t);return Math.log(Math.sqrt(2*Math.PI)*Math.pow(e,x+.5)*Math.exp(-e)*n)}static log(...t){Math.log(...t)}static log10(...t){Math.log10(...t)}static log1p(...t){Math.log1p(...t)}static log2(...t){Math.log2(...t)}static perm(t,a){return t<a?-1:this.factorial(t)/this.factorial(t-a)}static pow(t,a){return t**a}static prod(t,a=1){for(let r in t)a*=r;return a}static radians(t){return degrees*(Math.PI/180)}static remainder(t,a){return 0===a?t:(t%absY+Math.sign(a)*Math.abs(a))%Math.abs(a)}static sin(...t){Math.sin(...t)}static sinh(...t){Math.sinh(...t)}static sqrt(t){return t**.5}static tan(...t){Math.tan(...t)}static tanh(...t){Math.tanh(...t)}static trunc(...t){Math.trunc(...t)}}math.e=2.718281828459045,math.pi=3.141592653589793,math.tau=6.283185307179586,math.inf=1/0,math.nan=NaN,String.prototype.capitalize=function(t){let a=t.shift();return a.toUpperCase()+t.toLowerCase()},print(math.pi);
print(math.sqrt(math.pow(math.e,math.pi)));
print(math.factorial(round(math.pi * math.e)));