{"ScriptPreparationCode":"var num = -6.864601706668172e-10\r\n\r\nfunction round2(num, decimalPlaces = 0) {\r\n // return Math.round(value * (10 ** decimals)) / (10 ** decimals);\r\n // return Number(value.toFixed(decimals));\r\n if (num \u003C 0) {\r\n return -round2(-num, decimalPlaces);\r\n }\r\n var p = Math.pow(10, decimalPlaces);\r\n var n = num * p;\r\n var f = n - Math.floor(n);\r\n var e = Number.EPSILON * n;\r\n\r\n // Determine whether this fraction is a midpoint value.\r\n return (f \u003E= .5 - e) ? Math.ceil(n) / p : Math.floor(n) / p;\r\n}","TestCases":[{"Name":"toFixed","Code":"parseFloat(num.toFixed(8))","IsDeferred":false},{"Name":"mathjs.round","Code":"math.round(num, 8)","IsDeferred":false},{"Name":"round2","Code":"round2(num, 8)","IsDeferred":false}]}