mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-21 23:35:30 +03:00
Safe SquareRoot
This commit is contained in:
parent
254f8ba14d
commit
ff01781f6c
1 changed files with 8 additions and 4 deletions
|
@ -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;
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue