Skip to content

shz_powf

Markdown
SHZ_INLINE float shz_powf(float x, float p) SHZ_NOEXCEPT;

Fast approximation for C's powf().

NameTypeDescription
xfloat
pfloat

float

Computed as shz_pow2f(p * shz_log2f(x)), so the error of shz_log2f() is scaled by p and grows with |p|.

|p|Max relative error
0.253.9%
0.54.4%
15.7%
28.6%
311.5%
417.2%
840.1%
1686.0%
  • Measured maximum relative error for x in [0.001f, 1000.0f]:
  • x must be positive. Results are not exact for exact inputs: shz_powf(1.0f, p) is only 1.0f when p is 1.0f.
  • C++ equivalent: shz::powf
  • Type-generic form: none
  • Back-ends: SH4: shared C implementation · SW: portable C · SPU: shared C implementation
  • Defined in: sh4zam/shz_scalar.h:421
  • Module: Scalar, section "Transcendental"

shz_powif, shz_pow2f, shz_log2f