1.4.3.21 _LIBQ_Q3_12_log10_Q16 Function

Calculates the value of Log10(x).

Description

_Q3_12 _LIBQ_Q3_12_log10_Q16 (_Q16 x);

Calculates the log10(x), where log10(x) = ln(x) * log10(e). x is of type _Q16 and must be positive. The resulting value is of type _Q3_12.

Preconditions

The input x must be positive.

Parameters

x The input value from which to calculate log10(x).

Returns

_LIBQ_Q3_12_log10_Q16 returns the _Q3_12 fixed point result from the calculation log10(x).

Remarks

Execution Time (cycles): 301 typical (14 to 346)

Program Memory 176 bytes

Error <= 0.000244140625 (accurate to least significant _Q3_12 bit)

Example

_Q3_12 resultLog10;

resultLog10 = _LIBQ_Q3_12_log10_Q16 ((_Q16)0x12ed7d91); 
_// _LIBQ_Q3_12_log10_Q16(4845.490494)_ _= 3.685303 (0x3af7)_

C

_Q3_12 _LIBQ_Q3_12_log10_Q16 (_Q16 x );