Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TUKS-COURSE-TIMER by
Square Root
[Fast Math Functions]
Computes the square root of a number. More...
Functions | |
static __INLINE arm_status | arm_sqrt_f32 (float32_t in, float32_t *pOut) |
Floating-point square root function. | |
arm_status | arm_sqrt_q31 (q31_t in, q31_t *pOut) |
Q31 square root function. | |
arm_status | arm_sqrt_q15 (q15_t in, q15_t *pOut) |
Q15 square root function. |
Detailed Description
Computes the square root of a number.
There are separate functions for Q15, Q31, and floating-point data types. The square root function is computed using the Newton-Raphson algorithm. This is an iterative algorithm of the form:
x1 = x0 - f(x0)/f'(x0)
where x1
is the current estimate, x0
is the previous estimate, and f'(x0)
is the derivative of f()
evaluated at x0
. For the square root function, the algorithm reduces to:
x0 = in/2 [initial guess] x1 = 1/2 * ( x0 + in / x0) [each iteration]
Function Documentation
static __INLINE arm_status arm_sqrt_f32 | ( | float32_t | in, |
float32_t * | pOut | ||
) | [static] |
Floating-point square root function.
- Parameters:
-
[in] in input value. [out] *pOut square root of input value.
- Returns:
- The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
in
is negative value and returns zero output for negative values.
Definition at line 6100 of file arm_math.h.
arm_status arm_sqrt_q15 | ( | q15_t | in, |
q15_t * | pOut | ||
) |
Q15 square root function.
- Parameters:
-
[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF. [out] *pOut square root of input value.
- Returns:
- The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
in
is negative value and returns zero output for negative values.
arm_status arm_sqrt_q31 | ( | q31_t | in, |
q31_t * | pOut | ||
) |
Q31 square root function.
- Parameters:
-
[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. [out] *pOut square root of input value.
- Returns:
- The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
in
is negative value and returns zero output for negative values.
Generated on Tue Jul 12 2022 17:38:59 by
