MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / cbrt

Method cbrt

dnn/include/megdnn/dtype/half.hpp:1293–1305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1291 /// \param arg function argument
1292 /// \return function value stored in single-preicision
1293 MEGDNN_HOST MEGDNN_DEVICE static expr cbrt(float arg)
1294 {
1295#if defined(__CUDA_ARCH__)
1296 return expr(cbrtf(arg));
1297#elif HALF_ENABLE_CPP11_CMATH
1298 return expr(std::cbrt(arg));
1299#else
1300 if(builtin_isnan(arg) || builtin_isinf(arg))
1301 return expr(arg);
1302 return expr(builtin_signbit(arg) ? -static_cast<float>(pow(fabs(static_cast<double>(arg)), 1.0/3.0)) :
1303 static_cast<float>(pow(static_cast<double>(arg), 1.0/3.0)));
1304#endif
1305 }
1306
1307 /// Hypotenuse implementation.
1308 /// \param x first argument

Callers

nothing calls this directly

Calls 7

exprClass · 0.70
cbrtFunction · 0.70
builtin_isnanFunction · 0.70
builtin_isinfFunction · 0.70
builtin_signbitFunction · 0.70
powFunction · 0.70
fabsFunction · 0.70

Tested by

no test coverage detected