diff options
author | rihab kouki <rihab.kouki@st.com> | 2020-07-28 11:24:49 +0100 |
---|---|---|
committer | rihab kouki <rihab.kouki@st.com> | 2020-07-28 11:24:49 +0100 |
commit | 96d6da4e252b06dcfdc041e7df23e86161c33007 (patch) | |
tree | a262f59bb1db7ec7819acae435f5049cbe5e2354 /DSP/Source/FastMathFunctions/arm_sqrt_q31.c | |
parent | 9f95ff5b6ba01db09552b84a0ab79607060a2666 (diff) | |
download | st-cmsis-core-lowfat-master.tar.gz st-cmsis-core-lowfat-master.tar.bz2 st-cmsis-core-lowfat-master.zip |
Diffstat (limited to 'DSP/Source/FastMathFunctions/arm_sqrt_q31.c')
-rw-r--r-- | DSP/Source/FastMathFunctions/arm_sqrt_q31.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/DSP/Source/FastMathFunctions/arm_sqrt_q31.c b/DSP/Source/FastMathFunctions/arm_sqrt_q31.c index 0deea04..9889b13 100644 --- a/DSP/Source/FastMathFunctions/arm_sqrt_q31.c +++ b/DSP/Source/FastMathFunctions/arm_sqrt_q31.c @@ -3,13 +3,13 @@ * Title: arm_sqrt_q31.c * Description: Q31 square root function * - * $Date: 27. January 2017 - * $Revision: V.1.5.1 + * $Date: 18. March 2019 + * $Revision: V1.6.0 * * Target Processor: Cortex-M cores * -------------------------------------------------------------------- */ /* - * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. + * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -30,33 +30,34 @@ #include "arm_common_tables.h" /** - * @ingroup groupFastMath + @ingroup groupFastMath */ /** - * @addtogroup SQRT - * @{ + @addtogroup SQRT + @{ */ /** - * @brief Q31 square root function. - * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. - * @param[out] *pOut square root of input value. - * @return The function returns ARM_MATH_SUCCESS if the input value is positive - * and ARM_MATH_ARGUMENT_ERROR if the input is negative. For - * negative inputs, the function returns *pOut = 0. + @brief Q31 square root function. + @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF + @param[out] pOut points to square root of input value + @return execution status + - \ref ARM_MATH_SUCCESS : input value is positive + - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0 */ arm_status arm_sqrt_q31( q31_t in, q31_t * pOut) { - q31_t number, temp1, bits_val1, var1, signBits1, half; + q31_t bits_val1; + q31_t number, temp1, var1, signBits1, half; float32_t temp_float1; union { - q31_t fracval; - float32_t floatval; + q31_t fracval; + float32_t floatval; } tempconv; number = in; @@ -81,9 +82,9 @@ arm_status arm_sqrt_q31( /* Store the number for later use */ temp1 = number; - /*Convert to float */ + /* Convert to float */ temp_float1 = number * 4.6566128731e-010f; - /*Store as integer */ + /* Store as integer */ tempconv.floatval = temp_float1; bits_val1 = tempconv.fracval; /* Subtract the shifted value from the magic number to give intial guess */ @@ -133,10 +134,11 @@ arm_status arm_sqrt_q31( else { *pOut = 0; + return (ARM_MATH_ARGUMENT_ERROR); } } /** - * @} end of SQRT group + @} end of SQRT group */ |