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

Function frexp

include/half.hpp:4128–4137  ·  view source on GitHub ↗

Decompress floating-point number. See also:** Documentation for [std::frexp](https://en.cppreference.com/w/cpp/numeric/math/frexp). \param arg number to decompress \param exp address to store exponent at \return significant in range [0.5, 1) \exception FE_INVALID for signaling NaN

Source from the content-addressed store, hash-verified

4126 /// \return significant in range [0.5, 1)
4127 /// \exception FE_INVALID for signaling NaN
4128 inline half frexp(half arg, int *exp)
4129 {
4130 *exp = 0;
4131 unsigned int abs = arg.data_ & 0x7FFF;
4132 if(abs >= 0x7C00 || !abs)
4133 return (abs>0x7C00) ? half(detail::binary, detail::signal(arg.data_)) : arg;
4134 for(; abs<0x400; abs<<=1,--*exp) ;
4135 *exp += (abs>>10) - 14;
4136 return half(detail::binary, (arg.data_&0x8000)|0x3800|(abs&0x3FF));
4137 }
4138
4139 /// Multiply by power of two.
4140 /// This function is exact to rounding for all rounding modes.

Callers 1

float2half_implFunction · 0.85

Calls 2

halfClass · 0.85
signalFunction · 0.85

Tested by

no test coverage detected