assertion failure in std.range.iota
Ali Çehreli
acehreli at yahoo.com
Thu Aug 18 17:34:41 PDT 2011
On Fri, 19 Aug 2011 02:18:39 +0200, Andrej Mitrovic wrote:
> import std.range;
> import std.stdio;
>
> void main()
> {
> auto r1 = iota(0.0, 4.0, 0.03); // ok auto r2 = iota(0.0, 3.0,
> 0.03); //
> core.exception.AssertError at std.range(4001): Assertion failure }
>
> I want a range in steps of 0.03, beginning at 0.0 and ending at the
> closest point to 3.0.
>
> Line 4001 is:
> assert(start + count * step >= end);
An example of a floating point calculation error. (count * step) comes
out to be less than end. :-/
>
> This assertion and the code above it make absolutely no sense to me. The
> intention would be more clear if there was an error message, or any
> documentation of the implementation, but no dice.
Ali
More information about the Digitalmars-d-learn
mailing list