SHZ_ATAN2F_TERMS
#define SHZ_ATAN2F_TERMS 5Number of terms in the arctangent polynomial used by shz_atan2f().
Details
Section titled “Details”shz_atan2f() reduces its arguments to a quotient r within [-1, 1] and evaluates atan(r) = r * P(r^2). This selects the length of P: each additional term is one more multiply-accumulate.
| Terms | Degree | Maximum error (radians) | Cycles (model) |
|---|---|---|---|
| 2 | 3 | 6.2e-3 | 36 |
| 5 | 9 | 1.4e-5 | 45 |
| 6 | 11 | 2.5e-6 | 46 |
| 7 | 13 | 1.0e-6 | 49 |
Defaults to 5. To change it, define it as 2, 5, 6, or 7 for the entire build (on the compiler's command line), so that every translation unit and the library itself agree.
- The cycle counts are estimates from a pipeline model of the SH4 for one call within a loop over an array, with every access a cache hit. They are there to compare the settings with each other and are not measurements taken on a console.
Availability
Section titled “Availability”- C++ equivalent: none (usable from C++ as is)
- Back-ends: n/a (not a function)
- Defined in:
sh4zam/shz_trig.h:73 - Module: Trigonometry, section "Macros"