MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / lgamma

Method lgamma

extern/half/include/half.hpp:1594–1611  ·  view source on GitHub ↗

Gamma logarithm implementation. \param arg function argument \return function value stored in single-preicision

Source from the content-addressed store, hash-verified

1592 /// \param arg function argument
1593 /// \return function value stored in single-preicision
1594 static expr lgamma(float arg)
1595 {
1596 #if HALF_ENABLE_CPP11_CMATH
1597 return expr(std::lgamma(arg));
1598 #else
1599 if(builtin_isinf(arg))
1600 return expr(std::numeric_limits<float>::infinity());
1601 if(arg < 0.0f)
1602 {
1603 float i, f = std::modf(-arg, &i);
1604 if(f == 0.0f)
1605 return expr(std::numeric_limits<float>::infinity());
1606 return expr(static_cast<float>(1.1447298858494001741434273513531-
1607 std::log(std::abs(std::sin(3.1415926535897932384626433832795*f)))-lgamma(1.0-arg)));
1608 }
1609 return expr(static_cast<float>(lgamma(static_cast<double>(arg))));
1610 #endif
1611 }
1612
1613 /// Gamma implementation.
1614 /// \param arg function argument

Callers

nothing calls this directly

Calls 8

exprClass · 0.85
lgammaFunction · 0.85
builtin_isinfFunction · 0.85
infinityFunction · 0.85
modfFunction · 0.85
logFunction · 0.85
sinFunction · 0.85
absFunction · 0.70

Tested by

no test coverage detected