Skip to content

shz_acosf

Markdown
SHZ_INLINE float shz_acosf(float x) SHZ_NOEXCEPT;

Fast arccosine approximation; equivalent to C's acosf().

NameTypeDescription
xfloat

float

Returns the arccosine of x in radians, within [0, pi].

Accuracy: |shz_acosf(x) - acos(x)| <= 8e-6 radians (SHZ_ASINF_ERROR_MAX) over [-1, 1].

  • Arguments outside of [-1, 1] are clamped rather than producing a NaN: x >= 1 returns 0 and x <= -1 returns pi. A dot product of two unit vectors which lands just beyond 1 from rounding is safe to pass in.
  • C++ equivalent: shz::acosf
  • Type-generic form: none
  • Back-ends: SH4: shared C implementation · SW: portable C · SPU: shared C implementation
  • Defined in: sh4zam/shz_trig.h:222
  • Module: Trigonometry, section "Inverse Functions"

shz_asinf