Skip to content

shz_asinf

Markdown
SHZ_INLINE float shz_asinf(float x) SHZ_NOEXCEPT;

Fast arcsine approximation; equivalent to C's asinf().

NameTypeDescription
xfloat

float

Returns the arcsine of x in radians, within [-pi/2, pi/2].

Accuracy: |shz_asinf(x) - asin(x)| <= 8e-6 radians (SHZ_ASINF_ERROR_MAX) over [-1, 1]. The error is absolute, not relative: near zero the result has the sign of x and lies within the bound of it.

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

shz_acosf