calc.f00124e1.js 1.1 KB

1
  1. function s(t,c){let n,e,r;try{n=t.toString().split(".")[1].length}catch{n=0}try{e=c.toString().split(".")[1].length}catch{e=0}return r=Math.pow(10,Math.max(n,e)),(t*r+c*r)/r}function h(t,c){let n=0,e=0,r,i;try{n=t.toString().split(".")[1].length}catch{}try{e=c.toString().split(".")[1].length}catch{}return r=Number(t.toString().replace(".","")),i=Number(c.toString().replace(".","")),a(r/i,Math.pow(10,e-n))}function a(t,c){let n=0,e=t.toString(),r=c.toString();try{n+=e.split(".")[1].length}catch{}try{n+=r.split(".")[1].length}catch{}return Number(e.replace(".",""))*Number(r.replace(".",""))/Math.pow(10,n)}function u(t,c){let n,e,r,i;try{n=t.toString().split(".")[1].length}catch{n=0}try{e=c.toString().split(".")[1].length}catch{e=0}return r=Math.pow(10,Math.max(n,e)),i=n>=e?n:e,((t*r-c*r)/r).toFixed(i)}function l(t){return t==="NaN"||Number(t)===0?"0":t<1e3&&t>0||t<0&&t>-1e3?t:h(t,1e4).toFixed(2)+"W"}function p(t){return t==="NaN"||Number(t)===0?"0W":h(t,1e4).toFixed(2)+"W"}function m(t=[]){const c=Object.keys(t[0]);return t.reduce((n,e)=>c.reduce((r,i)=>({...r,[i]:s(n[i]||0,e[i])}),{}),{})}export{s as a,p as b,m as c,h as d,a as m,u as s,l as u};