http://d.puremagic.com/issues/show_bug.cgi?id=3000
Summary: iota should work with floats Product: D Version: 2.030 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzi...@digitalmars.com ReportedBy: dsim...@yahoo.com import std.range; void main() { auto foo = iota(0.0L, 10.0L, 1.0L); } The above doesn't compile and results in a bunch of long errors that aren't particularly useful for diagnosing the cause of the problem. The real problem is line 2089, range.d: return take((end - begin + step - 1) / step, Seq(tuple(begin, step), 0u)); The problem is that, if the arguments to iota are floats, not ints, the number of elements take() is told to take is a float, not an int. This can be fixed trivially by changing that line to: return take(cast(size_t) ((end - begin + step - 1) / step), Seq(tuple(begin, step), 0u)); Also, take() should probably use a ulong, not a size_t. I could picture someone wanting to run a long monte carlo simulation, for example, by taking more than 4 billion elements from an infinite range of random numbers. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------