← Back to index
|
Original Bugzilla link
Bug 4810 – dotProduct problem with ints
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-09-04T06:18:00Z
Last change time
2010-09-04T08:06:57Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0
by bearophile_hugs — 2010-09-04T06:18:42Z
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;
Comment #1
by dsimcha — 2010-09-04T08:06:57Z
http://dsource.org/projects/phobos/changeset/1953