Exact match. Not showing close matches.
PICList
Thread
'[PIC] Implementation of 8bit arctangent function'
2006\12\23@105440
by
Robert A LaBudde

I found a neat approximation for an arctangent in radians of a value of X
in [1,1]:
atan(X) = X / { 1 + 0.28 X*X } error < 0.005, X < 1
If I use 8bit fixed point, then the denominator will require 9 bits, which
creates an annoying problem with the division.
I see several solutions to the problem.
1. I can shift the denominator one bit to the right, creating a temporary 8
bit result, doing the division, and then shifting the quoteient one bit to
the right to compensate. Sort of a limited floating point.
2. Do a 32 bit by 16 bit division, and then convert to an 8bit answer.
Does anyone have experience with the best way to deal with this type of
precision issue?
Thanks.
================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS email: spam_OUTralTakeThisOuTlcfltd.com
Least Cost Formulations, Ltd. URL: http://lcfltd.com/
824 Timberlake Drive Tel: 7574670954
Virginia Beach, VA 234643239 Fax: 7574672947
"Vere scire est per causas scire"
================================================================
2006\12\23@220800
by
James Newtons Massmind
I'm probably not understanding something, but...
www.piclist.com/cgibin/constdivmul.exe?Acc=ACC&Bits=8&endian=little&
Const=.28&ConstErr=0.005&Temp=TEMP&cpu=pic16

James.
> {Original Message removed}
2006\12\25@104629
by
Scott Dattalo
> I found a neat approximation for an arctangent in radians of a value of X
> in [1,1]:
>
> atan(X) = X / { 1 + 0.28 X*X } error < 0.005, X < 1
>
> If I use 8bit fixed point, then the denominator will require 9 bits,
> which
> creates an annoying problem with the division.
Hi Robert,
If the implementation of the arctan is for a PIC, then you may wish to
consider:
http://www.dattalo.com/technical/software/pic/arctan.asm
This also has a similar error (~1/200) and doesn't involve any annoying
division. On the other hand, the returned result is in normalized radians
and thus may require an addition multiplication to convert to what ever
units you're using. (However, it should be pointed out that the lookup
table can be converted into other units).
Scott
2006\12\25@213625
by
Robert A LaBudde

At 10:45 AM 12/25/2006, Scott wrote:
>Hi Robert,
>
>If the implementation of the arctan is for a PIC, then you may wish to
>consider:
>
>http://www.dattalo.com/technical/software/pic/arctan.asm
>
>This also has a similar error (~1/200) and doesn't involve any annoying
>division. On the other hand, the returned result is in normalized radians
>and thus may require an addition multiplication to convert to what ever
>units you're using. (However, it should be pointed out that the lookup
>table can be converted into other units).
Thanks, Scott.
I'll implement my formula and compare to yours in terms of complexity and
space. I'll post the program when I'm done.
================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS email: .....ralKILLspam@spam@lcfltd.com
Least Cost Formulations, Ltd. URL: http://lcfltd.com/
824 Timberlake Drive Tel: 7574670954
Virginia Beach, VA 234643239 Fax: 7574672947
"Vere scire est per causas scire"
================================================================
More... (looser matching)
 Last day of these posts
 In 2006
, 2007 only
 Today
 New search...