Extract exponent. See also:** Documentation for [std::logb](https://en.cppreference.com/w/cpp/numeric/math/logb). \param arg number to query \return floating-point exponent \exception FE_INVALID for signaling NaN \exception FE_DIVBYZERO for 0
| 4237 | /// \exception FE_INVALID for signaling NaN |
| 4238 | /// \exception FE_DIVBYZERO for 0 |
| 4239 | inline half logb(half arg) |
| 4240 | { |
| 4241 | int abs = arg.data_ & 0x7FFF, exp; |
| 4242 | if(!abs) |
| 4243 | return half(detail::binary, detail::pole(0x8000)); |
| 4244 | if(abs >= 0x7C00) |
| 4245 | return half(detail::binary, (abs==0x7C00) ? 0x7C00 : detail::signal(arg.data_)); |
| 4246 | for(exp=(abs>>10)-15; abs<0x200; abs<<=1,--exp) ; |
| 4247 | unsigned int value = static_cast<unsigned>(exp<0) << 15; |
| 4248 | if(exp) |
| 4249 | { |
| 4250 | unsigned int m = std::abs(exp) << 6; |
| 4251 | for(exp=18; m<0x400; m<<=1,--exp) ; |
| 4252 | value |= (exp<<10) + m; |
| 4253 | } |
| 4254 | return half(detail::binary, value); |
| 4255 | } |
| 4256 | |
| 4257 | /// Next representable value. |
| 4258 | /// **See also:** Documentation for [std::nextafter](https://en.cppreference.com/w/cpp/numeric/math/nextafter). |