Extract integer and fractional parts. See also:** Documentation for [std::modf](https://en.cppreference.com/w/cpp/numeric/math/modf). \param arg number to decompress \param iptr address to store integer part at \return fractional part \exception FE_INVALID for signaling NaN
| 4217 | /// \return fractional part |
| 4218 | /// \exception FE_INVALID for signaling NaN |
| 4219 | inline half modf(half arg, half *iptr) |
| 4220 | { |
| 4221 | unsigned int abs = arg.data_ & 0x7FFF; |
| 4222 | if(abs > 0x7C00) |
| 4223 | { |
| 4224 | arg = half(detail::binary, detail::signal(arg.data_)); |
| 4225 | return *iptr = arg, arg; |
| 4226 | } |
| 4227 | if(abs >= 0x6400) |
| 4228 | return *iptr = arg, half(detail::binary, arg.data_&0x8000); |
| 4229 | if(abs < 0x3C00) |
| 4230 | return iptr->data_ = arg.data_ & 0x8000, arg; |
| 4231 | unsigned int exp = abs >> 10, mask = (1<<(25-exp)) - 1, m = arg.data_ & mask; |
| 4232 | iptr->data_ = arg.data_ & ~mask; |
| 4233 | if(!m) |
| 4234 | return half(detail::binary, arg.data_&0x8000); |
| 4235 | for(; m<0x400; m<<=1,--exp) ; |
| 4236 | return half(detail::binary, (arg.data_&0x8000)|(exp<<10)|(m&0x3FF)); |
| 4237 | } |
| 4238 | |
| 4239 | /// Extract exponent. |
| 4240 | /// **See also:** Documentation for [std::ilogb](https://en.cppreference.com/w/cpp/numeric/math/ilogb). |
no test coverage detected