calc.3602fe08.js 1.1 KB

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