lgamma & gamma reentrant

Travis Boucher boucher.travis at gmail.com
Wed Jan 5 10:33:30 PST 2011


I need some feedback from some of the math nerds on the list.

The functions gammaf and lgammaf are not reentrant and set a global 
'signgam' to indicate the sign.

Currently it looks like druntime/phobos2 use these non-reentrant 
versions, which could cause some issues in a threaded environment.

My questions for the math nerds are:

How important is this signgam value?

Should we provide a safe way of getting this value?

In std.math should we wrap the reentrant versions and store signgam in 
TLS, or should we expose the *_r reentrant versions in std.math directly?

I think now in D2 global variables are stored thread-local by default, 
so providing a safe signgam would be trivial (of course only accessible 
to the thread that called the lgamma/gamma).

Another option is to just leave it alone.  Personally I couldn't care 
less since I have never used the functions.

-- tbone


More information about the Digitalmars-d mailing list