Bug 86 – Minor loss of precision in std.math.tgamma
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P4
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-04-04T14:09:00Z
Last change time
2014-02-15T13:28:44Z
Assigned to
bugzilla
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2006-04-04T14:09:49Z
Here's a test point where the value of gamma is known exactly.
The implementation of tgamma in dsource:mathextra:etcgamma passes this test. But when this code was put into the DMC libraries, it somehow lost some precision in the translation. About 6 bits are wrong. (Further evidence that it's easier to write correct math code in D than in C++ !)
The bug does not exist in lgamma.
----
import std.math;
const real SQRT_PI = 1.77245385090551602729816748334114518279754945612238L;
void main() {
assert(tgamma(0.5L) == SQRT_PI);
}