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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5566 - [64-bit] More erratic FP results with size_t
Summary: [64-bit] More erratic FP results with size_t
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
Reported: 2011年02月12日 08:37 UTC by David Simcha
Modified: 2011年02月12日 21:54 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2011年02月12日 08:37:43 UTC
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 David Simcha 2011年02月12日 08:38:43 UTC
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.


AltStyle によって変換されたページ (->オリジナル) /