dmd 1.046 and 2.031 releases

"Jérôme M. Berger" jeberger at free.fr
Tue Jul 7 13:16:15 PDT 2009


Andrei Alexandrescu wrote:
> Jérôme M. Berger wrote:
>>  - A floating point range should allow you to specify the iteration 
>> step, or else it should allow you to iterate through all numbers that 
>> can be represented with the corresponding precision;
> 
> We don't have that, so you'd need to use a straigh for statement.
> 

struct FloatRange {
    float begin, end, step;
    bool includeBegin, includeEnd;

    int opApply (int delegate (ref float) dg) {
       whatever;
    }

    whatever;
}

>>  - The second issue remains: what if I want to include b but not b+ε 
>> for any ε>0?
> 
> real a, b;
> ...
> for (real f = a; f <= b; update(f))
> {
> }
> 
> I'd find it questionable to use ranged for with floats anyway.
> 
	So would I. But a range of floats is useful for more than iterating 
over it. Think interval arithmetic for example.

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20090707/6e804f92/attachment-0001.pgp>


More information about the Digitalmars-d-announce mailing list