MCPcopy Create free account
hub / github.com/apache/singa / lgamma

Function lgamma

include/half.hpp:3987–4001  ·  view source on GitHub ↗

Natural logarithm of gamma function. This function may be 1 ULP off the correctly rounded exact result for any rounding mode in ~0.025% of inputs. See also:** Documentation for [std::lgamma](https://en.cppreference.com/w/cpp/numeric/math/lgamma). \param arg function argument \return natural logarith of gamma function for \a arg \exception FE_INVALID for signaling NaN \exception FE_DIVBYZERO for 0

Source from the content-addressed store, hash-verified

3985 /// \exception FE_DIVBYZERO for 0 or negative integer arguments
3986 /// \exception FE_OVERFLOW, ...UNDERFLOW, ...INEXACT according to rounding
3987 inline half lgamma(half arg)
3988 {
3989 #if defined(HALF_ARITHMETIC_TYPE) && HALF_ENABLE_CPP11_CMATH
3990 return half(detail::binary, detail::float2half<half::round_style>(std::lgamma(detail::half2float<detail::internal_t>(arg.data_))));
3991 #else
3992 int abs = arg.data_ & 0x7FFF;
3993 if(abs >= 0x7C00)
3994 return half(detail::binary, (abs==0x7C00) ? 0x7C00 : detail::signal(arg.data_));
3995 if(!abs || arg.data_ >= 0xE400 || (arg.data_ >= 0xBC00 && !(abs&((1<<(25-(abs>>10)))-1))))
3996 return half(detail::binary, detail::pole());
3997 if(arg.data_ == 0x3C00 || arg.data_ == 0x4000)
3998 return half(detail::binary, 0);
3999 return half(detail::binary, detail::gamma<half::round_style,true>(arg.data_));
4000 #endif
4001 }
4002
4003 /// Gamma function.
4004 /// This function may be 1 ULP off the correctly rounded exact result for any rounding mode in <0.25% of inputs.

Callers

nothing calls this directly

Calls 3

halfClass · 0.85
signalFunction · 0.85
poleFunction · 0.85

Tested by

no test coverage detected