[Bug] Vec\range handles ints which don't roundtrip through floats wrong #422
Labels
Priority: Medium
This issue may be useful, and needs some attention.
Status: Accepted
It's clear what the subject of the issue is about, and what the resolution should be.
Status: Available
No one has claimed responsibility for resolving this issue.
Type: Bug
Inconsistencies or issues which will cause an issue or problem for users or implementors.
Describe the bug
When the arguments
$start
and$end
toVec\range(...)
are ints exceeding the max safe integer for a 64-bit double, this function may return a vec (list-like array) of length one because of floating point imprecision.To Reproduce
var_dump(Vec\range(1 << 60, (1 << 60) + 8));
Expected behavior
Environment (please complete the following information):
Additional context
Casting an int to a float may truncate the number. So this
if()
considers some large integers (or hugely negative integers) to be equal when they are not.The text was updated successfully, but these errors were encountered: