www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4805] New: no equality between iota and double literal

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4805

           Summary: no equality between iota and double literal
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



10:18:34 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4805


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsimcha yahoo.com
         Resolution|                            |FIXED



This is just floating point fuzz.  I changed the docs to say approxEqual
instead.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2010