03.08.2013 Views

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Function GFLIB_Sqrt_F16<br />

Figure 4-38. real sqrt(x) vs. GFLIB_Sqrt(f16In)<br />

Note<br />

The input value is limited to the range [0, 1), if not within this<br />

range the computed value is undefined.<br />

4.83.5 Re-entrancy<br />

The function is re-entrant.<br />

4.83.6 Code Example<br />

#include "gflib.h"<br />

tFrac16 f16In;<br />

tFrac16 f16Out;<br />

void main(void)<br />

{<br />

// input value = 0.5<br />

f16In = FRAC16 (0.5);<br />

// output should be 0x5A82 ~ FRAC16(0.70710678)<br />

f16Out = GFLIB_Sqrt_F16 (f16In);<br />

// output should be 0x5A82 ~ FRAC16(0.70710678)<br />

f16Out = GFLIB_Sqrt (f16In,Define F16);<br />

// ##############################################################<br />

// Available only if 16-bit fractional implementation selected<br />

// as default<br />

// ##############################################################<br />

<strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> <strong>PXR40xx</strong>, Rev. 1.0<br />

416 Freescale Semiconductor, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!