Slider: Add validation considering steps
This is unreliable because of floating-point errors. There's a very good chance that this check will fail in valid circumstances because of it.
I think that it is necessary to calculate with the same accuracy as MCPE to solve it accurately, but as an alternative method, can the problem be solved by aligning the values according to the number of digits of the step? If so, I don't think there is a practical problem.
I think that it is necessary to calculate with the same accuracy as MCPE to solve it accurately, but as an alternative method, can the problem be solved by aligning the values according to the number of digits of the step? If so, I don't think there is a practical problem.
No. It's like the old meme about 0.1 + 0.2 != 0.3. MCPE uses int32 precision, the server uses int64. Therefore there will always be discrepancies.
$step = 0.001;
$value = 6.006000518798828;
$a = round($value, strlen((string)$step));//float(6.006)
$b = $a / $step;//float(6006)
var_dump(ctype_digit((string)$b));//bool(true)
However, this is a successful calculation. Of course there is a possibility of an error, but is this a practical problem?