1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-20 06:45:14 +03:00

Safe SquareRoot

This commit is contained in:
JuliooCesarMDM 2021-08-15 18:46:39 -03:00
parent 254f8ba14d
commit ff01781f6c

View file

@ -524,11 +524,15 @@ float bellCurve(const float x, const float curveWidth)
}
float fast_fsqrtf(const double value) {
float ret = 0.0f;
#ifdef USE_ARM_MATH
float squirt;
arm_sqrt_f32(value, &squirt);
return squirt;
arm_sqrt_f32(value, &ret);
#else
return sqrtf(value);
ret = sqrtf(value);
#endif
if (isnan(ret))
{
return 0;
}
return ret;
}