blob: 93b013e8da6a22a67661e591870b43725b408537 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <Functions/FunctionMathUnary.h>
#include <Functions/FunctionFactory.h>
#if defined(OS_DARWIN)
extern "C"
{
double lgamma_r(double x, int * signgamp);
}
#endif
namespace DB
{
namespace
{
/// Use wrapper and use lgamma_r version because std::lgamma is not threadsafe.
Float64 lgamma_wrapper(Float64 arg)
{
int signp;
return lgamma_r(arg, &signp);
}
struct LGammaName { static constexpr auto name = "lgamma"; };
using FunctionLGamma = FunctionMathUnary<UnaryFunctionVectorized<LGammaName, lgamma_wrapper>>;
}
REGISTER_FUNCTION(LGamma)
{
factory.registerFunction<FunctionLGamma>();
}
}
|