-
-
Notifications
You must be signed in to change notification settings - Fork 739
Open
Description
acehreli (@acehreli) reported this on 2023-01-07T02:32:50Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=23604
Description
The documentation at
https://dlang.org/library/std/range/iota.html
currently states
"The two-argument overloads have step = 1. If begin < end
&& step < 0 or begin > end && step > 0 or begin == end,
then an empty range is returned."
However, the implementation for floating point types does not match documentation:
import std;
void test(T)() {
assert(iota(T(1), T(2), T(-1)).empty);
assert(iota(T(2), T(1)).empty); // By-default step==1
assert(iota(T(3), T(3)).empty); // By-default step==1
}
void main() {
test!int; // Produces empty ranges: GOOD
test!double; // asserts: BAD
}
See the following thread for further discussion:
https://forum.dlang.org/thread/rdbvirgshewaujtsscnp@forum.dlang.org