Bug 5566 – [64-bit] More erratic FP results with size_t

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2011-02-12T08:37:00Z
Last change time
2011-02-12T21:54:05Z
Keywords
wrong-code
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-02-12T08:37:43Z
I think this bug might have the same root cause as bug 5565. It was reduced from completely different code and I don't really understand the root cause of either very well, though, so I'm filing a separate bug report in case I'm wrong. Even if it is related to 5565, this test case is simpler. import std.math, std.stdio; double fun(ulong k, ulong n, double p) { return pow(1.0 - p, cast(double) n); } void main() { // Should print 0.8 ^ 10 = 0.1073741824. Prints 0.956352. writeln(fun(0, 10, 0.2)); }
Comment #1 by dsimcha — 2011-02-12T08:38:43Z
Argh, again I forgot to mention, this test case does not reproduce the bug if inlining is enabled, probably because fun() gets inlined. In the larger case I reduced it from, inlining could be enabled and the bug would still be reproduced.
Comment #2 by bugzilla — 2011-02-12T21:54:05Z