std.range.package.iota has a bug in how it calculates the number of steps to
take. The following inputs cause a to!size_t() to round a 999.9999999 down
instead of up to 1000, which then causes an assert failure.
-------------------------
import std.range;
void main()
{
iota(8.5300000000000011, 438.17803623529841, 0.4296480362352984);
}
-------------------------
$ rdmd test.d
core.exception.AssertError@/home/brian/.dvm/compilers/dmd-2.078.0/linux/bin/../../src/phobos/std/range/package.d(5594): Assertion failure
----------------
??:? _d_assertp [0x96e25d65]
??:? pure ref @safe std.range.iota!(double, double, double).iota(double, double, double).Result std.range.iota!(double, double, double).iota(double, double, double).Result.__ctor(double, double, double) [0x96e252fe]
??:? pure @safe std.range.iota!(double, double, double).iota(double, double, double).Result std.range.iota!(double, double, double).iota(double, double, double) [0x96e251c0]
??:? _Dmain [0x96e250e7]
Comment #1 by dlang — 2019-09-08T11:14:38Z
While looking at that problem, I found some related problems:
------
iota(-5.0,double.max,1.0)
leeds to "Conversion positive overflow", due to end-start = +infinity
------
iota(0.0,1e30,1.0);
leeds to "Conversion positive overflow", due to 1e30 > long.max
------
import std.math: nextUp;
iota(0.0,1.0,nextUp(0.0));
leeds to "Conversion positive overflow", due to > long.max potential elements
------
iota(1,1+2*float.epsilon,float.epsilon/4)
Works at the moment, but might lead to an endless loop, depending on the bugfix.