Enumeration implementation. \param from number to increase/decrease \param to direction to enumerate into \return next representable number
| 1814 | /// \param to direction to enumerate into |
| 1815 | /// \return next representable number |
| 1816 | static half nextafter(half from, half to) |
| 1817 | { |
| 1818 | uint16 fabs = from.data_ & 0x7FFF, tabs = to.data_ & 0x7FFF; |
| 1819 | if(fabs > 0x7C00) |
| 1820 | return from; |
| 1821 | if(tabs > 0x7C00 || from.data_ == to.data_ || !(fabs|tabs)) |
| 1822 | return to; |
| 1823 | if(!fabs) |
| 1824 | return half(binary, (to.data_&0x8000)+1); |
| 1825 | bool lt = ((fabs==from.data_) ? static_cast<int>(fabs) : -static_cast<int>(fabs)) < |
| 1826 | ((tabs==to.data_) ? static_cast<int>(tabs) : -static_cast<int>(tabs)); |
| 1827 | return half(binary, from.data_+(((from.data_>>15)^static_cast<unsigned>(lt))<<1)-1); |
| 1828 | } |
| 1829 | |
| 1830 | /// Enumeration implementation. |
| 1831 | /// \param from number to increase/decrease |