[Bug 86] New: Minor loss of precision in std.math.tgamma

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 4 12:09:50 PDT 2006


           Summary: Minor loss of precision in std.math.tgamma
           Product: D
           Version: 0.151
          Platform: PC
               URL: digitalmars.com digitalmars.D.bugs:6898
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P4
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: clugdbug at yahoo.com.au

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);


More information about the Digitalmars-d-bugs mailing list