Hi thanks for the infor
sorry just to check the value for
sin(x)
the x is it in rad?
regards
----- Original Message -----
From: "Spehro Pefhany" <EraseMEspeffspam_OUTTakeThisOuTINTERLOG.COM>
To: <PICLISTspam_OUTMITVMA.MIT.EDU>
Sent: Tuesday, November 26, 2002 7:05 AM
Subject: Re: Sin and cos maths funtion on PIC(AN660 )
> At 08:49 PM 11/26/02 -0800, you wrote:
> >Hi every one
> >
> >Do any one have any experience in use sine and cos maths function on PIC.
> >like the one stated in the microchip AN660 document(using minimax
> >approximations). Can any one kindly enlighten me what method they use cos
> >I am current running short of memory and I need to replace their fixed
> >point multiplication routine with my standard multiplication routine. I
am
> >not able to understand the flow of the program is there any material that
> >I can read on?
>
> Microchip is just using a polynomial to approximate a segment of the
> function, and very simple trig transformations to get the operand into the
> domain where the polynomial is relatively accurate. Minmax just refers to
the
{Quote hidden}> criteria for finding the "optimal" polynomial coefficients. If you are
> going to be using their coefficients, then you don't need to know how
> to do that.
>
> I didn't delve further into the AN (it looks pretty lucid, actually), but
> polynomials are typically evaluated using Horner's method, which is
> fast and yields minimum error.
>
> P(x) = a*x^n + b*x^(n-1)... p*x + q
>
> = (..((x * a) + b) * x) +... + q
>
> So you need only n multiplications and n additions to get the answer.
> When using fixed point multiplication, you have to be especially careful
> of overflow and of letting the numbers get too small so accuracy suffers.
> You might have to scale at each operation to keep the numbers in the
> right range, and adjust the coefficients appropriately.
>
> If you don't need much performance speed-wise, you might consider
> re-writing the routine to use your pre-existing (?) FP multiplication
> routine, which should save space.
>
> Best regards,
>
> Spehro Pefhany --"it's the network..." "The Journey is the
reward"
> @spam@speffKILLspaminterlog.com Info for manufacturers:
http://www.trexon.com
> Embedded software/hardware/analog Info for designers:
http://www.speff.com
>
> --
> http://www.piclist.com#nomail Going offline? Don't AutoReply us!
> email KILLspamlistservKILLspammitvma.mit.edu with SET PICList DIGEST in the body
>
>
--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body