{"ScriptPreparationCode":"function generateRandomDecimalInRangeFormatted(min, max) {\r\n let value = (Math.random() * (max - min \u002B 1)) \u002B min;\r\n return Number.parseFloat(value).toFixed(Math.random() * 10);\r\n}\r\n\r\nvar size = 100;\r\n\r\nvar arr = [];\r\n\r\nfor (i = 0; i \u003C size; i\u002B\u002B) {\r\n arr.push(generateRandomDecimalInRangeFormatted(0, 1));\r\n}","TestCases":[{"Name":"utility","Code":"function removeTrailingZeroAndDots(\r\n value,\r\n removeDots = false\r\n) {\r\n if (!value) return \u0027\u0027;\r\n\r\n let result = typeof value === \u0027number\u0027 ? String(value) : value;\r\n\r\n result = result\r\n // Remove decimal 0. \u00601.000\u0060 =\u003E \u00601.\u0060, \u00601.100\u0060 =\u003E \u00601.1\u0060, \u00601.000\u0060 =\u003E \u00601.0\u0060\r\n .replace(/(\\.\\d*[^0])0*$/, \u0027$1\u0027)\r\n // Remove useless decimal. \u00601.0\u0060 =\u003E \u00601.\u0060 or \u00601\u0060, \u00601.\u0060 =\u003E \u00601\u0060\r\n .replace(/\\.0*$/, removeDots ? \u0027\u0027 : \u0027.\u0027);\r\n\r\n return result;\r\n};\r\n\r\nfunction getPrecision(str) {\r\n return removeTrailingZeroAndDots(str)?.split(\u0027.\u0027)[1]?.length || 0\r\n}\r\n\r\nfor (i = 0; i \u003C size; i\u002B\u002B) {\r\n const precision = getPrecision(arr[i]);\r\n console.log(precision)\r\n}","IsDeferred":false},{"Name":"log","Code":"function getLog10Precision(str) {\r\n const precision = Math.log10(Number(str)) * -1;\r\n return precision;\r\n}\r\n\r\nfor (i = 0; i \u003C size; i\u002B\u002B) {\r\n const precision = getLog10Precision(arr[i]);\r\n console.log(precision)\r\n}","IsDeferred":false},{"Name":"e","Code":"function getEPrecision(value) {\r\n const num = typeof value === \u0027string\u0027 ? \u002Bvalue : value\r\n if (!isFinite(num)) return 0;\r\n var e = 1, p = 0;\r\n while (Math.round(num * e) / e !== num) { e *= 10; p\u002B\u002B; }\r\n return p;\r\n}\r\n\r\nfor (i = 0; i \u003C size; i\u002B\u002B) {\r\n const precision = getEPrecision(arr[i]);\r\n console.log(precision)\r\n}","IsDeferred":false}]}