MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / remainder

Method remainder

include/half/half.hpp:1260–1284  ·  view source on GitHub ↗

Remainder implementation. \param x first operand \param y second operand \return Half-precision division remainder stored in single-precision

Source from the content-addressed store, hash-verified

1258 /// \param y second operand
1259 /// \return Half-precision division remainder stored in single-precision
1260 static expr remainder(float x, float y)
1261 {
1262 #if HALF_ENABLE_CPP11_CMATH
1263 return expr(std::remainder(x, y));
1264 #else
1265 if(builtin_isnan(x) || builtin_isnan(y))
1266 return expr(std::numeric_limits<float>::quiet_NaN());
1267 float ax = std::fabs(x), ay = std::fabs(y);
1268 if(ax >= 65536.0f || ay < std::ldexp(1.0f, -24))
1269 return expr(std::numeric_limits<float>::quiet_NaN());
1270 if(ay >= 65536.0f)
1271 return expr(x);
1272 if(ax == ay)
1273 return expr(builtin_signbit(x) ? -0.0f : 0.0f);
1274 ax = std::fmod(ax, ay+ay);
1275 float y2 = 0.5f * ay;
1276 if(ax > y2)
1277 {
1278 ax -= ay;
1279 if(ax >= y2)
1280 ax -= ay;
1281 }
1282 return expr(builtin_signbit(x) ? -ax : ax);
1283 #endif
1284 }
1285
1286 /// Remainder implementation.
1287 /// \param x first operand

Callers

nothing calls this directly

Calls 7

exprClass · 0.85
remainderFunction · 0.85
builtin_isnanFunction · 0.85
fabsFunction · 0.85
ldexpFunction · 0.85
builtin_signbitFunction · 0.85
fmodFunction · 0.85

Tested by

no test coverage detected