shz_powf
SHZ_INLINE float shz_powf(float x, float p) SHZ_NOEXCEPT;Fast approximation for C's powf().
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
x | float | |
p | float |
Returns
Section titled “Returns”float
Details
Section titled “Details”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.25 | 3.9% |
| 0.5 | 4.4% |
| 1 | 5.7% |
| 2 | 8.6% |
| 3 | 11.5% |
| 4 | 17.2% |
| 8 | 40.1% |
| 16 | 86.0% |
- Measured maximum relative error for
xin [0.001f, 1000.0f]:
Warnings
Section titled “Warnings”xmust be positive. Results are not exact for exact inputs:shz_powf(1.0f,p) is only1.0fwhenpis1.0f.
Availability
Section titled “Availability”- 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"