HP 12C: Quickly Approximating Arc Tangent
The HP 12C does not have trigonometric functions. Various sources list on how such functions are be approximated with varying degrees of accuracy. Today’s blog will feature a quick approximation, using only a 14 step function for the arc tangent (inverse tangent) function.
Formula Used in Approximation
(see Source)
arctan(x) ≈ x ÷ (1 + 0.28125 * x²) = x ÷ (1 + 9 * x² ÷ 32)
Best for -1 ≤ x ≤ 1
Maximum absolute error of 0.0049 radians, approximately 0.28°. The error gets worse outside these ranges. The program rounds the result to 2 decimal places. The angle is returned in radians.
HP 12C Program: Arc-tangent Approximations
FIX 2 |
01 |
42, 2 |
Program start |
ENTER |
02 |
36 |
|
ENTER |
03 |
36 |
|
× |
04 |
20 |
|
9 |
05 |
9 |
|
× |
06 |
20 |
|
3 |
07 |
3 |
|
2 |
08 |
2 |
|
÷ |
09 |
10 |
|
1 |
10 |
1 |
|
+ |
11 |
40 |
|
÷ |
12 |
10 |
|
RND |
13 |
42, 14 |
Round result to 2 decimal places |
GTO 00 |
14 |
43, 33, 00 |
Program end |
Examples
x = 0.1. Result: 0.10
x = 0.3. Result: 0.29
x = 0.5. Result: 0.47
Source
Sreeraman Rajan, Sichun Wang, Rober Inkol, and Alain Joyal. “Efficient Approximations for the Arctangent Function” IEEE Signal Processing Magazine. May 2006.
Eddie
All original content copyright, © 2011-2026. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.