{"ScriptPreparationCode":"var value = -0.07\r\nvar step = 0.01\r\nvar min = -5\r\n\r\nfunction validateStepWithAbs(value, step, min = 0) {\r\n if (value == null) return false\r\n\r\n var absValue = Math.abs(value)\r\n var absStep = Math.abs(step)\r\n var absMin = Math.abs(min)\r\n\r\n while (\r\n (absValue \u003E 0 \u0026\u0026 absValue \u003C 1) ||\r\n (absStep \u003E 0 \u0026\u0026 absStep \u003C 1) ||\r\n (absMin \u003E 0 \u0026\u0026 absMin \u003C 1)\r\n ) {\r\n value *= 10\r\n step *= 10\r\n min *= 10\r\n\r\n absValue = Math.abs(value)\r\n absStep = Math.abs(step)\r\n absMin = Math.abs(min)\r\n }\r\n\r\n return (value - min) % step === 0\r\n}\r\n\r\nfunction validateStepWithMultiply(value, step, min = 0) {\r\n if (value == null) return false\r\n\r\n while (\r\n (value !== 0 \u0026\u0026 value * value \u003C 1) ||\r\n (step !== 0 \u0026\u0026 step * step \u003C 1) ||\r\n (min !== 0 \u0026\u0026 min * min \u003C 1)\r\n ) {\r\n value *= 10\r\n step *= 10\r\n min *= 10\r\n }\r\n\r\n return (value - min) % step === 0\r\n}","TestCases":[{"Name":"Math.abs(x) ","Code":"validateStepWithAbs(value, step, min)","IsDeferred":false},{"Name":"compare x*x ","Code":"validateStepWithMultiply(value, step, min)","IsDeferred":false}]}