1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-21 23:35:30 +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 fast_fsqrtf(const double value) {
float ret = 0.0f;
#ifdef USE_ARM_MATH #ifdef USE_ARM_MATH
float squirt; arm_sqrt_f32(value, &ret);
arm_sqrt_f32(value, &squirt);
return squirt;
#else #else
return sqrtf(value); ret = sqrtf(value);
#endif #endif
if (isnan(ret))
{
return 0;
}
return ret;
} }