MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / nextafter

Method nextafter

extern/half/include/half.hpp:1816–1828  ·  view source on GitHub ↗

Enumeration implementation. \param from number to increase/decrease \param to direction to enumerate into \return next representable number

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

halfClass · 0.70

Tested by

no test coverage detected