std.range.iota enhancement: supporting more types (AKA issue 10762)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Dec 24 09:10:53 PST 2013


On 12/24/13 5:09 AM, Joseph Rushton Wakeling wrote:
> On 24/12/13 13:58, monarch_dodra wrote:
>> I think you are missing the point of what happens if the step is not 1
>> (or if
>> the passed in type can have fractional input). EG:
>>
>> iota(0, 105, 10);
>> or
>> iota(0, 10.5);
>>
>> In this case, "back" should be 100, and not 95. To compute back, you
>> need to be
>> able to evaluate length, and to add length*inc to front.
>
> Oh, snap.  Have we been working on the same problems for too long? :-)

The integral cases are easy. We need to crack the floating point case: 
given numbers low, up, and step, what's the closest number smaller than 
up that's reached by repeated adds of step to low?

Andrei



More information about the Digitalmars-d mailing list