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

Table of Results

Hardware

AM243x LaunchPad

Software

  • TI Arm Clang Compiler v2.0.0.STS
  • MCU+ SDK for AM243x v8.2.0.31
Table 3-1 Table of Results - Arm Cortex®-R5F
Trig Function Library C Function Input Range

[Rad]

Max Error Max Cycles Avg Cycles Approximation Type
Sine C <Math.h> sinf() Any 0.0000000296 179 150 Polynomial
CMSIS arm_sin_f32() Any 0.0000181917 48 48 Lookup table (2 KB)
TI Arm Trig ti_arm_sin() 0:2π 0.0000007225 29 29 Polynomial
Cosine C <Math.h> cosf() Any 0.0000000297 179 150 Polynomial
CMSIS arm_cos_f32() Any 0.0000183477 50 50 Lookup table
TI Arm Trig ti_arm_cos() 0:2π 0.0000002863 37 37 Polynomial
Sine + Cosine
C <Math.h> NA - - - - -
CMSIS arm_sin_cos_f32() Any 0.0000006100 83 83 Lookup table
TI Arm Trig ti_arm_sincos() 0:2π 0.0000001925 54 54 Polynomial
Arcsine C <Math.h>

asinf()

Any 0.0000000590 213 132 Polynomial
CMSIS NA - - - - -
TI Arm Trig ti_arm_asin() Any 0.0000003428 59 59 Polynomial
Arccosine C <Math.h> acosf() Any 0.0000001792 128 87 Polynomial
CMSIS NA - - - - -
TI Arm Trig ti_arm_acos() Any 0.0000004295 64 64 Polynomial
Arctangent C <Math.h> atanf() Any 0.0000001748 128 87 Polynomial
CMSIS NA - - - - -
TI Arm Trig ti_arm_atan Any 0.0000001748 64 64 Polynomial
Arctangent2 C <Math.h> atan2f() Any 0.0000002021 222 148 Polynomial
CMSIS NA - - - - -
TI Arm Trig ti_arm_atan2 Any 0.0000002957 59 49 Polynomial