# mfr32Sqrt() in DSP_Func_MFR bean

Started by ●May 1, 2006

I'm programming an MC56F8347 with DSP_Func_MFR bean, because I need a sqrt
function. mfr32Sqrt() always seems to provide an answer that is 70.7% of a
correct answer: for example, if mfr32Sqrt(1000000) returns 707 instead of 1000.
It does the same thing with other input parameters as well. Is this a bug, or is
there something wrong with me?

Reply by ●May 8, 20062006-05-08

This function and all the rest of functions in

DSP_Func_MFR are fractional function. But you took

this function as a decimal function. You need use

fractional data as inputs. So, the input 1000000 in

decimal is equal to 0.0004656612873077392578125 in

fractional. Its sqrt result is

0.021579186437577744274928111636501 in 16-bit format.

Converts it to decimal, the result is

707.10678118654752440084436208845.

For example, mfr32Sqrt(FRAC32(0.25)) = FRAC16(0.5).

Charlie

--- k...@gmail.com wrote:

> I'm programming an MC56F8347 with DSP_Func_MFR bean,

> because I need a sqrt function. mfr32Sqrt() always

> seems to provide an answer that is 70.7% of a

> correct answer: for example, if mfr32Sqrt(1000000)

> returns 707 instead of 1000. It does the same thing

> with other input parameters as well. Is this a bug,

> or is there something wrong with me?

>

__________________________________________________

DSP_Func_MFR are fractional function. But you took

this function as a decimal function. You need use

fractional data as inputs. So, the input 1000000 in

decimal is equal to 0.0004656612873077392578125 in

fractional. Its sqrt result is

0.021579186437577744274928111636501 in 16-bit format.

Converts it to decimal, the result is

707.10678118654752440084436208845.

For example, mfr32Sqrt(FRAC32(0.25)) = FRAC16(0.5).

Charlie

--- k...@gmail.com wrote:

> I'm programming an MC56F8347 with DSP_Func_MFR bean,

> because I need a sqrt function. mfr32Sqrt() always

> seems to provide an answer that is 70.7% of a

> correct answer: for example, if mfr32Sqrt(1000000)

> returns 707 instead of 1000. It does the same thing

> with other input parameters as well. Is this a bug,

> or is there something wrong with me?

>

__________________________________________________