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

Function ilogb

include/half.hpp:4221–4231  ·  view source on GitHub ↗

Extract exponent. See also:** Documentation for [std::ilogb](https://en.cppreference.com/w/cpp/numeric/math/ilogb). \param arg number to query \return floating-point exponent \retval FP_ILOGB0 for zero \retval FP_ILOGBNAN for NaN \retval INT_MAX for infinity \exception FE_INVALID for 0 or infinite values

Source from the content-addressed store, hash-verified

4219 /// \retval INT_MAX for infinity
4220 /// \exception FE_INVALID for 0 or infinite values
4221 inline int ilogb(half arg)
4222 {
4223 int abs = arg.data_ & 0x7FFF, exp;
4224 if(!abs || abs >= 0x7C00)
4225 {
4226 detail::raise(FE_INVALID);
4227 return !abs ? FP_ILOGB0 : (abs==0x7C00) ? INT_MAX : FP_ILOGBNAN;
4228 }
4229 for(exp=(abs>>10)-15; abs<0x200; abs<<=1,--exp) ;
4230 return exp;
4231 }
4232
4233 /// Extract exponent.
4234 /// **See also:** Documentation for [std::logb](https://en.cppreference.com/w/cpp/numeric/math/logb).

Callers

nothing calls this directly

Calls 1

raiseFunction · 0.85

Tested by

no test coverage detected