On 24/12/13 11:38, Francesco Cattoglio wrote:
Ah, nice. There's an unstated assumption here - adding inc n times is the same
as adding n * inc.
Right, completely missed that. I guess checking a few test cases at compile time
is the best one can do. Checking for every n could take some infinite amount of
time :P
Example case:
iota(x, y, (x - y) / N)
... where x and y are floating point and N is anything other than a power of 2.
You will probably wind up with cases where you get an unexpected extra point
on the end that is (x - y - tinyEpsilon).
DMD may be more prone to this than GDC/LDC. I once ran into a very amusing
error with DMD (not using iota) when I tried to traverse the closed interval
[0.0, 1.0] in increments of 0.1.