September 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4810

           Summary: dotProduct problem with ints
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2010-09-04 06:18:42 PDT ---
With DMD 2.048 this dotProduct doesn't work:

import std.numeric;
void main() {
    assert(dotProduct([1, 3, -5], [4, -2, -1]) == 3);
}



This is the first part of dotProduct:

Unqual!(CommonType!(F1, F2))
dotProduct(F1, F2)(in F1[] avector, in F2[] bvector)
{
    immutable n = avector.length;
    assert(n == bvector.length);
    auto avec = avector.ptr, bvec = bvector.ptr;
    typeof(return) sum0 = 0.0, sum1 = 0.0;


To fix it replace this:
typeof(return) sum0 = 0.0, sum1 = 0.0;

With:
typeof(return) sum0 = 0, sum1 = 0;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 04, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4810


David Simcha <dsimcha@yahoo.com> changed:

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


--- Comment #1 from David Simcha <dsimcha@yahoo.com> 2010-09-04 08:06:57 PDT ---
http://dsource.org/projects/phobos/changeset/1953

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