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_F32<br />

Figure 4-37. real sqrt(x) vs. GFLIB_Sqrt(f32In)<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.82.5 Re-entrancy<br />

The function is re-entrant.<br />

4.82.6 Code Example<br />

#include "gflib.h"<br />

tFrac32 f32In;<br />

tFrac32 f32Out;<br />

void main(void)<br />

{<br />

// input value = 0.5<br />

f32In = FRAC32 (0.5);<br />

// output should be 0x5A820000 ~ FRAC32(0.70710678)<br />

f32Out = GFLIB_Sqrt_F32 (f32In);<br />

// output should be 0x5A820000 ~ FRAC32(0.70710678)<br />

f32Out = GFLIB_Sqrt (f32In,Define F32);<br />

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

// Available only if 32-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 />

414 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!