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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Function GFLIB_Sqrt_FLT<br />

In the above, the operations to remove last exponent bit <strong>and</strong> add the bias (according to<br />

st<strong>and</strong>ard IEEE754) can be combined into a single operation. The <strong>for</strong>mula can be rewritten<br />

into C language as:<br />

Equation GFLIB_Sqrt_Eq2<br />

For error elimination are the two Babylonian steps added to give a quadratic<br />

improvement:<br />

Equation GFLIB_Sqrt_Eq3<br />

Equation GFLIB_Sqrt_Eq4<br />

Figure 4-39 depicts a floating point sqrt(x) function generated from Matlab <strong>and</strong> the<br />

calculated value of the sqrt function obtained from GFLIB_Sqrt_FLT, plus their<br />

difference. The course of calculation accuracy as a function of the input value can be<br />

observed from this figure. The computed value is equal to or is 1LSB less than the true<br />

square root value. In order to obtain a value with a 0.5LSB (16bit) accuracy, additional<br />

iterations are required.<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 />

418 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!