1.4.3.30 _LIBQ_ToFloatQ31 Function

Converts a _Q31 value to a float.

Description

float _LIBQ_ToFloatQ31(_Q31 x);

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

Preconditions

None.

Parameters

x The _Q31 fixed point value to convert to float

Returns

_LIBQ_ToFloatQ31 returns the floating point (float) value corresponding to the _Q31 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): 163 typical (54 to 176)

Program Memory 28 bytes

Example

float f;

f = _LIBQ_ToFloatQ31((_Q31)0x00004000); _// f now equals 0.000008_

f = _LIBQ_ToFloatQ31((_Q31)0x80000000); _// f now equals -1.0_

f = _LIBQ_ToFloatQ31((_Q31)0x5851f42d); _// f now equals 0.690001_

C

float  _LIBQ_ToFloatQ31 (_Q31 x );