digitalmars.D.learn - assertion failure in std.range.iota
- Andrej Mitrovic (15/15) Aug 18 2011 import std.range;
- Ali =?iso-8859-1?q?=C7ehreli?= (4/22) Aug 18 2011 An example of a floating point calculation error. (count * step) comes
- Andrej Mitrovic (1/1) Aug 19 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6531
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.
Aug 18 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 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
Aug 18 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6531
Aug 19 2011