Thread overview | |||||
---|---|---|---|---|---|
|
August 19, 2011 assertion failure in std.range.iota | ||||
---|---|---|---|---|
| ||||
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@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); 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. |
August 19, 2011 Re: assertion failure in std.range.iota | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | 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@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 |
August 19, 2011 Re: assertion failure in std.range.iota | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | http://d.puremagic.com/issues/show_bug.cgi?id=6531 |
Copyright © 1999-2021 by the D Language Foundation