Gamma implementation. \param arg function argument \return function value stored in single-preicision
| 1601 | /// \param arg function argument |
| 1602 | /// \return function value stored in single-preicision |
| 1603 | static expr tgamma(float arg) |
| 1604 | { |
| 1605 | #if HALF_ENABLE_CPP11_CMATH |
| 1606 | return expr(std::tgamma(arg)); |
| 1607 | #else |
| 1608 | if(arg == 0.0f) |
| 1609 | return builtin_signbit(arg) ? expr(-std::numeric_limits<float>::infinity()) : expr(std::numeric_limits<float>::infinity()); |
| 1610 | if(arg < 0.0f) |
| 1611 | { |
| 1612 | float i, f = std::modf(-arg, &i); |
| 1613 | if(f == 0.0f) |
| 1614 | return expr(std::numeric_limits<float>::quiet_NaN()); |
| 1615 | double value = 3.1415926535897932384626433832795 / (std::sin(3.1415926535897932384626433832795*f)*std::exp(lgamma(1.0-arg))); |
| 1616 | return expr(static_cast<float>((std::fmod(i, 2.0f)==0.0f) ? -value : value)); |
| 1617 | } |
| 1618 | if(builtin_isinf(arg)) |
| 1619 | return expr(arg); |
| 1620 | return expr(static_cast<float>(std::exp(lgamma(static_cast<double>(arg))))); |
| 1621 | #endif |
| 1622 | } |
| 1623 | |
| 1624 | /// Floor implementation. |
| 1625 | /// \param arg value to round |
nothing calls this directly
no test coverage detected