make a note for a rainy future .
AdditionNumber.prototype.add =functionARG) {var r1,r2,m;try{r1=This.tostring (). Split (".") [1].length}catch (e) {r1=0}Try{r2=arg.tostring (). Split (".") [1].length}catch (e) {r2=0} m=Math.pow (10,Math.max (R1,R2))Return (this*m+arg*m)/M}SubtractionNumber.prototype.sub =function (ARG) {ReturnThis.add (-ARG); }MultiplicationNumber.prototype.mul =function (ARG) {var m=0,s1=This.tostring (), s2=arg.tostring ();Try{m+=s1.split (".") [1].length}catch (e) {}Try{m+=s2.split (".") [1].length}catch (e) {}ReturnNumber (S1.replace (".",""))*Number (S2.replace (".",""))/Math.pow (10,M)}DivisionNumber.prototype.div =function (ARG) {var t1=0,t2=0,R1,R2; try{t1=this.tostring (). Split (1].length} catch (e) {} try{t2=arg.tostring (). Split ( 1].length} catch (e) {} with (Math) {r1=< Span class= "hljs-built_in" >number (this.tostring (). replace ( ".", number (arg.tostring (). replace (", "return (R1/R2) *pow ( 10,t2-t1); } }
JS floating point subtraction accuracy inaccurate