1.4.3.29 _LIBQ_ToFloatQ15 Function

Converts a _Q15 value to a float.

Description

float _LIBQ_ToFloatQ15(_Q15 x);

Converts a _Q15 fixed point value to a floating point representation. The floating point value is returned by the function.

Preconditions

None.

Parameters

x The _Q15 fixed point value to convert to float

Returns

_LIBQ_ToFloatQ15 returns the floating point (float) value corresponding to the _Q15 input value.

Remarks

The C library functions __floatsisf and __divsf3 are called by this routine and thus must be linked in to the executable image.

Execution Time (cycles): 158 typical (54 to 176)

Program Memory 28 bytes

Example

float f;

f = _LIBQ_ToFloatQ15((_Q15)0x4000); _// f now equals 0.5_

f = _LIBQ_ToFloatQ15((_Q15)0x8000); _// f now equals -1.0_

f = _LIBQ_ToFloatQ15((_Q15)0xb7ff); _// f now equals -0.562531_

C

float  _LIBQ_ToFloatQ15 (_Q15 x );