Bug 4805 – no equality between iota and double literal
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-09-03T10:18:00Z
Last change time
2010-09-03T16:28:36Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2010-09-03T10:18:34Z
From this unittest in the documentation: http://www.digitalmars.com/d/2.0/phobos/std_range.html#iota
import std.algorithm;
import std.range;
void main()
{
auto rf = iota(0.0, 0.5, 0.1);
assert(equal(rf, [0.0, 0.1, 0.2, 0.3, 0.4]));
}
This assertion fails. I'm not sure if it is because of floating-point representation being different(?) or if this is really a bug. But its in the docs, so the code either has to go or there's a bug.
Comment #1 by dsimcha — 2010-09-03T16:28:36Z
This is just floating point fuzz. I changed the docs to say approxEqual instead.