[phobos] Simplify iota for floating-point types?

Andrei Alexandrescu andrei at erdani.com
Thu Dec 23 21:45:07 PST 2010


On 12/23/10 10:33 PM, Robert Jacques wrote:
> On Thu, 23 Dec 2010 11:20:24 -0700, Andrei Alexandrescu
> <andrei at erdani.com> wrote:
>
>> Per the recent discussion comparing D with Lua, tests suggest that
>> iota for double is too slow. This is a necessity if iota is a
>> bidirectional or random-access range. If we allow it to be a forward
>> range, then performance would be significantly increased.
>>
>> Do you agree with making iota for floating-point types a forward range?
>>
>>
>> Andrei
>
> I had thought the major slowdown was using code like 'start + step * i'
> as opposed to 'current += step', which, although much faster is
> fundamentally broken, as with floating point numbers x = (x+1), etc. Am
> I mistaken?

Indeed you are correct.

Andrei


More information about the phobos mailing list