SPRAD27A July   2022  – August 2022 AM2431 , AM2432 , AM2434 , AM2631 , AM2631-Q1 , AM2632 , AM2632-Q1 , AM2634 , AM2634-Q1 , AM2732 , AM2732-Q1 , AM6411 , AM6412 , AM6421 , AM6422 , AM6441 , AM6442

 

  1.   Abstract
  2.   Trademarks
  3. 1Introduction
  4. 2Trigonometric Optimizations
    1. 2.1 Lookup Table-Based Approximation
    2. 2.2 Polynomial Approximation
      1. 2.2.1 Optimizing Sine and Cosine
        1. 2.2.1.1 Sine Cosine Polynomials From Sollya
      2. 2.2.2 Optimizing Arctangent and Arctangent2
        1. 2.2.2.1 Arctangent Polynomials
  5. 3Trig Library Benchmarks
    1. 3.1 C Math.h Library
    2. 3.2 Arm “Fast Math Functions” in CMSIS
    3. 3.3 TI Arm Trig Library
    4. 3.4 Table of Results
  6. 4Optimizations
    1. 4.1 Branch Prediction
    2. 4.2 Floating-Point Single-Precision Instructions
    3. 4.3 Memory Placement
    4. 4.4 Compiler
  7.   Revision History

Arctangent Polynomials

Table 2-3 shows the coefficients for the arctangent approximation obtained from the Sollya program. The table shows the error expected given the range reduction and order of the polynomial.

Table 2-3 Coefficients for the Arctangent
Range Terms Abs err Polynomial
-1 : 1 4 8.00E-05
Equation 21. x * (0.99921381473541259765625 + x2 * (-0.321175038814544677734375 + x2 * (0.146264731884002685546875 + x2 * (-3.8986742496490478515625e-2))))
-1 : 1 5 2.30E-05
Equation 22. x * (0.999970018863677978515625 + x2 * (-0.3317006528377532958984375 + x2 * (0.1852150261402130126953125 + x2 * (-9.1925732791423797607421875e-2 + x2 * 2.386303804814815521240234375e-2))))
-1 : 1 6 3.40E-06
Equation 23. x * (0.999995648860931396484375 + x2 * (-0.3329949676990509033203125 + x2 * (0.19563795626163482666015625 + x2 * (-0.121243648231029510498046875 + x2 * (5.7481847703456878662109375e-2 + x2 * (-1.3482107780873775482177734375e-2))))))
tan(pi/12) 3 2.00E-07
Equation 24. x * (0.999994814395904541015625 + x2 * (-0.3327477872371673583984375 + x2 * 0.18327605724334716796875))
tan(pi/12) 4 3.00E-09
Equation 25. x * (0.999999940395355224609375 + x2 * (-0.333319008350372314453125 + x2 * (0.19920165836811065673828125 + x2 * (-0.12685041129589080810546875))))
tan(pi/12) 5 8.70E-11
Equation 26. x * (1 + x2 * (-0.333333194255828857421875 + x2 * (0.19998063147068023681640625 + x2 * (-0.14202083647251129150390625 + x2 * 9.6703059971332550048828125e-2))))