Skip to content

SHZ_ATAN2F_TERMS

Markdown
#define SHZ_ATAN2F_TERMS 5

Number of terms in the arctangent polynomial used by shz_atan2f().

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.

TermsDegreeMaximum error (radians)Cycles (model)
236.2e-336
591.4e-545
6112.5e-646
7131.0e-649

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.

shz_atan2f, SHZ_ATAN2F_ERROR_MAX