Sound Open Firmware
Loading...
Searching...
No Matches
sqrt.h File Reference
Include dependency graph for sqrt.h:

Go to the source code of this file.

Functions

uint16_t sofm_sqrt_int16 (uint16_t u)
 sofm_sqrt_int16() - Calculate 16-bit fractional square root function.
int32_t sofm_sqrt_int32 (int32_t n)
 sofm_sqrt_int32() - Calculate 32-bit fractional square root function.

Function Documentation

◆ sofm_sqrt_int16()

uint16_t sofm_sqrt_int16 ( uint16_t u)

sofm_sqrt_int16() - Calculate 16-bit fractional square root function.

Parameters
uInput value in Q4.12 format, from 0 to 16.0.
Returns
Calculated square root of n in Q4.12 format, from 0 to 4.0.

◆ sofm_sqrt_int32()

int32_t sofm_sqrt_int32 ( int32_t n)

sofm_sqrt_int32() - Calculate 32-bit fractional square root function.

Parameters
nInput value in Q2.30 format, from 0 to 2.0.
Returns
Calculated square root of n in Q2.30 format.

The input range of square root function is matched with Q1.31 complex numbers range where the magnitude squared can be to 2.0. The function returns zero for non-positive input values.