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

Function fdim

include/half.hpp:2903–2908  ·  view source on GitHub ↗

Positive difference. This function is exact to rounding for all rounding modes. See also:** Documentation for [std::fdim](https://en.cppreference.com/w/cpp/numeric/math/fdim). \param x first operand \param y second operand \return \a x - \a y or 0 if difference negative \exception FE_... according to operator-(half,half)

Source from the content-addressed store, hash-verified

2901 /// \return \a x - \a y or 0 if difference negative
2902 /// \exception FE_... according to operator-(half,half)
2903 inline half fdim(half x, half y)
2904 {
2905 if(isnan(x) || isnan(y))
2906 return half(detail::binary, detail::signal(x.data_, y.data_));
2907 return (x.data_^(0x8000|(0x8000-(x.data_>>15)))) <= (y.data_^(0x8000|(0x8000-(y.data_>>15)))) ? half(detail::binary, 0) : (x-y);
2908 }
2909
2910 /// Get NaN value.
2911 /// **See also:** Documentation for [std::nan](https://en.cppreference.com/w/cpp/numeric/math/nan).

Callers

nothing calls this directly

Calls 3

isnanFunction · 0.85
halfClass · 0.85
signalFunction · 0.85

Tested by

no test coverage detected