www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 86] New: Minor loss of precision in std.math.tgamma

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=86

           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 digitalmars.com
        ReportedBy: clugdbug 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);
}


-- 
Apr 04 2006
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=86


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from bugzilla digitalmars.com  2006-04-11 01:33 -------
Fixed 0.153


-- 
Apr 10 2006