Thread overview | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 15, 2014 [Issue 13474] 32 bit DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 Илья Ярошенко <ilyayaroshenko@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86 |All Severity|critical |blocker --- Comment #1 from Илья Ярошенко <ilyayaroshenko@gmail.com> --- //Fails both DMD -m32 and -m64 import core.stdc.tgmath; double sumKBN(double[] d) { double s = 0.0; double c = 0.0; foreach(double x; d) { double t = s + x; if(s.fabs >= x.fabs) c += (s-t)+x; else c += (x-t)+s; s = t; } return s + c; } unittest { assert(3 == [1, 1e100, 1, -1e100].sumKBN); } -- |
September 15, 2014 [Issue 13474] 32 bit DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 --- Comment #2 from Илья Ярошенко <ilyayaroshenko@gmail.com> --- //Fails both DMD -m32 and -m64 import core.stdc.tgmath; double sumKBN(double[] d) { double s = 0.0; double c = 0.0; foreach(double x; d) { double t = s + x; if(s.fabs >= x.fabs) c += (s-t)+x; else c += (x-t)+s; s = t; } return s + c; } unittest { assert(3 == [1, 1e100, 1, -1e100].sumKBN); } -- |
September 15, 2014 [Issue 13474] DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 Илья Ярошенко <ilyayaroshenko@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|32 bit DMD optimizer FP |DMD optimizer FP arithmetic |arithmetic bug |bug -- |
September 15, 2014 [Issue 13474] DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 --- Comment #3 from Илья Ярошенко <ilyayaroshenko@gmail.com> --- Please Discard previous 2 comments. //$ dmd -m32 -O -main -unittest -run test4.d //core.exception.AssertError@test4.d(28): 0 import core.stdc.tgmath; double sumKBN(Range)(Range r) { double s = 0.0; double c = 0.0; foreach(double x; r) { double t = s + x; if(s.fabs >= x.fabs) c += (s-t)+x; else c += (x-t)+s; s = t; } return s + c; } unittest { import std.algorithm, std.range, std.conv; auto ar1 = [1, 1e100, 1, -1e100].map!(a => a*10000).array; auto ar2 = [1, 1e100, 1, -1e100].map!(a => a*10000); double r = 20000; assert(r == ar1.sumKBN); // Ok assert(r == ar2.sumKBN, ar2.sumKBN.to!string); // fails } -- |
September 15, 2014 [Issue 13474] 32 bit DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 Илья Ярошенко <ilyayaroshenko@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|All |x86 Summary|DMD optimizer FP arithmetic |32 bit DMD optimizer FP |bug |arithmetic bug -- |
September 15, 2014 [Issue 13474] 32 bit DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 --- Comment #4 from Илья Ярошенко <ilyayaroshenko@gmail.com> --- Tests added: https://github.com/D-Programming-Language/dmd/pull/3995 https://github.com/D-Programming-Language/dmd/pull/3992 -- |
September 16, 2014 [Issue 13474] 32 bit DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 Илья Ярошенко <ilyayaroshenko@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code -- |
September 18, 2014 [Issue 13474] 32 bit DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 Илья Ярошенко <ilyayaroshenko@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=13485 -- |
February 08, 2015 [Issue 13474] 32 bit DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies@gmail.com --- Comment #5 from yebblies <yebblies@gmail.com> --- Reduced: double change(double x) { return x * 10000; } void main() { double c = 0x1.388p+13; double s = 0x1.652efdc6018a2p+345; double t = s + 10000; c += s - t + 10000; s = t; auto x = change(-1e100); double u = s + x; c += x - u + s; s = u; assert(s + c == 20000); } -- |
February 08, 2015 [Issue 13474] 32 bit DMD optimizer FP arithmetic bug | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13474 --- Comment #6 from Илья Ярошенко <ilyayaroshenko@gmail.com> --- F foo(F)(F c, F d) { c += d; c += d; return c; } void test1() { alias F = double; enum F d = (cast(F)(2)) ^^ (F.max_exp - 1); assert(foo(-d, d) == d); } -- |
Copyright © 1999-2021 by the D Language Foundation