D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4805 - no equality between iota and double literal
Summary: no equality between iota and double literal
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-03 10:18 UTC by Andrej Mitrovic
Modified: 2010-09-03 16:28 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2010-09-03 10:18:34 UTC
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 David Simcha 2010-09-03 16:28:36 UTC
This is just floating point fuzz.  I changed the docs to say approxEqual instead.