A 200 bytes table would do it (2 bytes per entry), Intermediate values could be easily calculated by interpolation with a minimum error between each table entry. For example: X/Y could be from 0 to 1, equivalent to 0 to 45¡ (from 45¡ to 90¡ is the same as ATan(Y/X). Table entry 000 = 00000, representing 0¡ Table entry 100 = 45000, (AFC8h) representing 45¡. (Table values means angle times 1000). Considere X/Y = 0.167, table entry 16 is "9090" (2382h) [9.090¡] table entry 17 is "9648" (25B0h) [9.648¡] so 9648-9090 = 558 (table step). [0.558¡] The third decimal digit from the division x/y is 7, means 70% from 0.16 and 0.17, so the correspondent interpolation is 558 x 70% = 390.6 (multiplication routine rounds to 391) [0.391¡], that you need to add to the 16th table entry "9090", so the result would be decimal 9481 (2509h), Convert it (2509h) to decimal (9481) and let three digits after the decimal point, resulting in 9.481¡. The real ATan(0.167) = 9.480903...¡, so a 0.001% of error in a 16 bits table is pretty good. Whenever Y > X, invert the formula, use Y/X instead and the result would be 90¡ less the angle found. To increase the resolution, increase the table entries from 100 to 200. Wagner Jason Wolfson wrote: > > OK, now I'm starting to spin my wheels, > > What would be the best way to calculate > an arcTangent with a PIC? > > I have 2 values, x and y, values are 0-100, > I need to find an angle by taking the > arcTan of (y/x). > > thanks > Jason Wolfson