mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-20 06:45:14 +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 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue