Possible std.math.exp() bug

anthony.difranco at yale.edu anthony.difranco at yale.edu
Thu Apr 6 11:18:05 PDT 2006


>Good to have another mathematics programmer around!
I'm trying.  D has been very kind to me so far, with both reasonable semantics
and reasonable efficiency, and now a reasonable community.

>> Also, is there a better way to do the ratio of two gammas than subtracting
>> lgammas and exp at the end?
>
>Do you mean, more accurate way? If the numbers are not too large, I 
>don't think it matters much, even a simple division of the tgammas is 
>probably OK, but lgamma() will save you from overflow problems.
>If the arguments are large, the Stirling approximation is used, so there 
>may be potential for greater accuracy. I'd be amazed if it actually 
>mattered, though.

Actually, I should have said an as-overflow-resistant-as-possible way to do
something like permutations (basically ratio of gammas).  Or maybe some useful
scaling identity that doesn't wreck precision, though squeezing out the last few
bits is not a concern.  My application (statistics related) is making even
lgamma overflow as a matter of course.





More information about the Digitalmars-d-bugs mailing list