# C++ API

Source: https://sh4zam.com/api/cpp/

> The SH4ZAM C++ API in namespace shz: classes, operators and aliases, mapped to the C functions they call

C++ code can still use the C API by design, and every C++ type is also compatible with its corresponding C types and C API, so you can mix and match.

Include `<sh4zam/shz_sh4zam.hpp>` (or a per-module `.hpp`). Vector, quaternion and matrix types derive from the C structs and add methods and operators; `shz::xmtrx` exposes the active matrix as static member functions; scalar and trig routines are `constexpr` aliases of the C functions with the `shz_` prefix dropped.

## Classes

| Class | C type | Header | Description |
| --- | --- | --- | --- |
| [`shz::vecN`](https://sh4zam.com/api/cpp/vecn/) | n/a | `sh4zam/shz_vector.hpp` | Common C++ base structure inherited by all vector types. |
| [`shz::vec2`](https://sh4zam.com/api/cpp/vec2/) | [`shz_vec2_t`](https://sh4zam.com/api/vector/shz_vec2_t/) | `sh4zam/shz_vector.hpp` | 2D Vector type |
| [`shz::vec3`](https://sh4zam.com/api/cpp/vec3/) | [`shz_vec3_t`](https://sh4zam.com/api/vector/shz_vec3_t/) | `sh4zam/shz_vector.hpp` | 3D Vector type |
| [`shz::vec4`](https://sh4zam.com/api/cpp/vec4/) | [`shz_vec4_t`](https://sh4zam.com/api/vector/shz_vec4_t/) | `sh4zam/shz_vector.hpp` | 4D Vector type |
| [`shz::quat`](https://sh4zam.com/api/cpp/quat/) | [`shz_quat_t`](https://sh4zam.com/api/quat/shz_quat_t/) | `sh4zam/shz_quat.hpp` | C++ structure representing a quaternion. |
| [`shz::mat4x4`](https://sh4zam.com/api/cpp/mat4x4/) | [`shz_mat4x4_t`](https://sh4zam.com/api/matrix/shz_mat4x4_t/) | `sh4zam/shz_matrix.hpp` |  |
| [`shz::xmtrx`](https://sh4zam.com/api/cpp/xmtrx/) | n/a | `sh4zam/shz_xmtrx.hpp` | Static structure around the 4x4 XMTRX FP register back-bank. |
| [`shz::sincos`](https://sh4zam.com/api/cpp/sincos/) | [`shz_sincos_t`](https://sh4zam.com/api/trig/shz_sincos_t/) | `sh4zam/shz_trig.hpp` | C++ sine/cosine approximation pairs. |
| [`shz::complex`](https://sh4zam.com/api/cpp/complex/) | [`shz_complex_t`](https://sh4zam.com/api/complex/shz_complex_t/) | `sh4zam/shz_complex.hpp` | C++ wrapper around a floating-point complex number, real/imaginary pair. |
| [`shz::version`](https://sh4zam.com/api/cpp/version/) | n/a | `sh4zam/shz_version.hpp` | Class representing a full SH4ZAM API version. |

## Scalar aliases

| C++ | C function | Description |
| --- | --- | --- |
| `shz::fminf` | [`shz_fminf`](https://sh4zam.com/api/scalar/shz_fminf/) | Returns the minimum value of two given floats. |
| `shz::fmaxf` | [`shz_fmaxf`](https://sh4zam.com/api/scalar/shz_fmaxf/) | Returns the maximum value of two given floats. |
| `shz::equalf` | [`shz_equalf`](https://sh4zam.com/api/scalar/shz_equalf/) | Checks for equality based on EITHER the absolute tolerance or relative tolerance, using [`SHZ_FLT_EPSILON`](https://sh4zam.com/api/scalar/SHZ_FLT_EPSILON/). |
| `shz::equalf_abs` | [`shz_equalf_abs`](https://sh4zam.com/api/scalar/shz_equalf_abs/) | Checks for equality based on the absolute tolerance using [`SHZ_FLT_EPSILON`](https://sh4zam.com/api/scalar/SHZ_FLT_EPSILON/). |
| `shz::equalf_rel` | [`shz_equalf_rel`](https://sh4zam.com/api/scalar/shz_equalf_rel/) | Checks for equality based on the relative tolerance using [`SHZ_FLT_EPSILON`](https://sh4zam.com/api/scalar/SHZ_FLT_EPSILON/). |
| `shz::floorf` | [`shz_floorf`](https://sh4zam.com/api/scalar/shz_floorf/) | Replacement for the \<math.h> routine, floorf(). |
| `shz::ceilf` | [`shz_ceilf`](https://sh4zam.com/api/scalar/shz_ceilf/) | Replacement for the \<math.h> routine, ceilf(). |
| `shz::roundf` | [`shz_roundf`](https://sh4zam.com/api/scalar/shz_roundf/) | Replacement for the \<math.h> routine, roundf(). |
| `shz::truncf` | [`shz_truncf`](https://sh4zam.com/api/scalar/shz_truncf/) | Replacement for the \<math.h> routine, truncf(). |
| `shz::remainderf` | [`shz_remainderf`](https://sh4zam.com/api/scalar/shz_remainderf/) | Replacement for the \<math.h> routine, remainderf(). |
| `shz::fmodf` | [`shz_fmodf`](https://sh4zam.com/api/scalar/shz_fmodf/) | Replacement for the \<math.h> routine, fmodf(). |
| `shz::remquof` | [`shz_remquof`](https://sh4zam.com/api/scalar/shz_remquof/) | (Sorta) Replacement for the \<math.h> routine, remquof(). |
| `shz::clampf` | [`shz_clampf`](https://sh4zam.com/api/scalar/shz_clampf/) | Clamps a floating-point value by the given `min` and `max` values. |
| `shz::normalizef` | [`shz_normalizef`](https://sh4zam.com/api/scalar/shz_normalizef/) | Maps a value within the given range `from` to `to`, to be within the range of `0.0f += 1.0f`. |
| `shz::normalizef_fsrra` | [`shz_normalizef_fsrra`](https://sh4zam.com/api/scalar/shz_normalizef_fsrra/) | Maps a value within the given range `from` to `to`, to be within the range of `0.0f + 1.0f` more quickly, provided `to` - `from` is a positive difference. |
| `shz::remapf` | [`shz_remapf`](https://sh4zam.com/api/scalar/shz_remapf/) | Maps a value within the given range `inputStart` to `inputEnd`, to be within the range of `outputStart` to `outputEnd`. |
| `shz::remapf_fsrra` | [`shz_remapf_fsrra`](https://sh4zam.com/api/scalar/shz_remapf_fsrra/) | Maps a value within the given range `inputStart` to `inputEnd`, to be within the range of `outputStart` to `outputEnd` more quickly, provided the `outputEnd` - `outputStart` is a positive difference. |
| `shz::wrapf` | [`shz_wrapf`](https://sh4zam.com/api/scalar/shz_wrapf/) | Wraps the given `value` back to be within the range of `min` to `max`. |
| `shz::wrapf_fsrra` | [`shz_wrapf_fsrra`](https://sh4zam.com/api/scalar/shz_wrapf_fsrra/) | Wraps the given `value` back to be within the range of `min` to `max` more quickly, provided `max` - `min` is a positive difference. |
| `shz::fractf` | [`shz_fractf`](https://sh4zam.com/api/scalar/shz_fractf/) | Returns the fractional part of `x`, equivalent to GLSL `fract()`. |
| `shz::signf` | [`shz_signf`](https://sh4zam.com/api/scalar/shz_signf/) | Returns -1.0f if `x` \< 0, 0.0f if `x` == 0, or 1.0f if `x` > 0. |
| `shz::saturatef` | [`shz_saturatef`](https://sh4zam.com/api/scalar/shz_saturatef/) | Clamps `x` to the range \[0.0f, 1.0f\]. |
| `shz::fabsf` | [`shz_fabsf`](https://sh4zam.com/api/scalar/shz_fabsf/) | Replacement for the \<math.h> routine, fabsf(). |
| `shz::copysignf` | [`shz_copysignf`](https://sh4zam.com/api/scalar/shz_copysignf/) | Replacement for the \<math.h> routine, copysignf(). |
| `shz::fmaf` | [`shz_fmaf`](https://sh4zam.com/api/scalar/shz_fmaf/) | Replacement for the \<math.h> routine, fmaf(). |
| `shz::fdimf` | [`shz_fdimf`](https://sh4zam.com/api/scalar/shz_fdimf/) | Replacement for the \<math.h> routine, fdimf(),. |
| `shz::hypotf` | [`shz_hypotf`](https://sh4zam.com/api/scalar/shz_hypotf/) | Replacement for the \<math.h> routine, hypotf(). |
| `shz::lerpf` | [`shz_lerpf`](https://sh4zam.com/api/scalar/shz_lerpf/) | Returns a value that is linearly interpolated between `a` and `b` by the given ratio, `t`. |
| `shz::barycentric_lerpf` | [`shz_barycentric_lerpf`](https://sh4zam.com/api/scalar/shz_barycentric_lerpf/) | Returns a value that is barycentrically interpolated between `a`, `b`, and `c` using the given barycentric coordinates, `u` and `v`. |
| `shz::quadratic_roots` | [`shz_quadratic_roots`](https://sh4zam.com/api/scalar/shz_quadratic_roots/) | Uses the quadratic formula with the given coefficients to solve for the two roots, returning `true` if any real roots exist, and `false` if the roots are only imaginary. |
| `shz::randf` | [`shz_randf`](https://sh4zam.com/api/scalar/shz_randf/) | Returns a random floating-point number between `0.0f` and `1.0f`, using and updating the given seed. |
| `shz::randf_range` | [`shz_randf_range`](https://sh4zam.com/api/scalar/shz_randf_range/) | Returns a random floating-point number between `min` and `max`, using and updating the given seed. |
| `shz::stepf` | [`shz_stepf`](https://sh4zam.com/api/scalar/shz_stepf/) | returns 0.0f if x \< edge, otherwise 1.0f |
| `shz::smoothstepf` | [`shz_smoothstepf`](https://sh4zam.com/api/scalar/shz_smoothstepf/) | Returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between. edge0 must be less than edge1 or result is undefined. |
| `shz::smoothstepf_safe` | [`shz_smoothstepf_safe`](https://sh4zam.com/api/scalar/shz_smoothstepf_safe/) | Returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between. Accepts inverse edges. |
| `shz::cbrtf` | [`shz_cbrtf`](https://sh4zam.com/api/scalar/shz_cbrtf/) | Replacement for the \<math.h> routine, cbrtf(). |
| `shz::inv_sqrtf_fsrra` | [`shz_inv_sqrtf_fsrra`](https://sh4zam.com/api/scalar/shz_inv_sqrtf_fsrra/) | Calculates 1.0f/sqrtf( `x`), using a fast approximation. |
| `shz::inv_sqrtf` | [`shz_inv_sqrtf`](https://sh4zam.com/api/scalar/shz_inv_sqrtf/) | Calculates 1.0f/sqrtf( `x` ), using a fast approximation, while safely protecting against division-by-zero. |
| `shz::sqrtf_fsrra` | [`shz_sqrtf_fsrra`](https://sh4zam.com/api/scalar/shz_sqrtf_fsrra/) | Returns the fast approximate square root of the given value, `x`. |
| `shz::sqrtf` | [`shz_sqrtf`](https://sh4zam.com/api/scalar/shz_sqrtf/) | Returns the fast approximate square root of the given value, `x`, safely returning `0.0f` is `x` == `0.0f`. |
| `shz::invf_fsrra` | [`shz_invf_fsrra`](https://sh4zam.com/api/scalar/shz_invf_fsrra/) | Takes the inverse of `x` using a very fast approximation, returning a positive result. |
| `shz::invf` | [`shz_invf`](https://sh4zam.com/api/scalar/shz_invf/) | Takes the inverse of `x` using a slighty faster approximation than doing a full division, safely handling negative values. |
| `shz::divf_fsrra` | [`shz_divf_fsrra`](https://sh4zam.com/api/scalar/shz_divf_fsrra/) | Divides `num` by `denom` using a very fast approximation, which requires `denom` be a positive value. |
| `shz::divf` | [`shz_divf`](https://sh4zam.com/api/scalar/shz_divf/) | Divides `num` by `denom` using a slightly faster approximation, allowing `denom` to be negative. |
| `shz::dot6f` | [`shz_dot6f`](https://sh4zam.com/api/scalar/shz_dot6f/) | Takes two sets of 3D vectors as 3 floats and calculates their dot product using an approximation. |
| `shz::dot8f` | [`shz_dot8f`](https://sh4zam.com/api/scalar/shz_dot8f/) | Takes two sets of 4D vectors as 4 floats and calculates their dot product using an approximation. |
| `shz::mag_sqr3f` | [`shz_mag_sqr3f`](https://sh4zam.com/api/scalar/shz_mag_sqr3f/) | Takes a 3D vector as 3 floats and calculates its squared magnitude using a fast approximation. |
| `shz::mag_sqr4f` | [`shz_mag_sqr4f`](https://sh4zam.com/api/scalar/shz_mag_sqr4f/) | Takes a 4D vector as 4 floats and calculates its squared magnitude using a fast approximation. |
| `shz::pow2f` | [`shz_pow2f`](https://sh4zam.com/api/scalar/shz_pow2f/) | Fast approximation for raising 2 to a floating-point power. |
| `shz::powf` | [`shz_powf`](https://sh4zam.com/api/scalar/shz_powf/) | Fast approximation for C's powf(). |
| `shz::pow10f` | [`shz_pow10f`](https://sh4zam.com/api/scalar/shz_pow10f/) | Fast approximation of POSIX's pow10f(). |
| `shz::log2f` | [`shz_log2f`](https://sh4zam.com/api/scalar/shz_log2f/) | Fast approximation for C's log2f(). |
| `shz::logf` | [`shz_logf`](https://sh4zam.com/api/scalar/shz_logf/) | Fast approximation for C's logf(). |
| `shz::log10f` | [`shz_log10f`](https://sh4zam.com/api/scalar/shz_log10f/) | Fast approximation for C's log10f(). |
| `shz::expf` | [`shz_expf`](https://sh4zam.com/api/scalar/shz_expf/) | Fast approximation for C's expf(). |
| `shz::operator/` | [`shz_invf`](https://sh4zam.com/api/scalar/shz_invf/) | Takes the inverse of `x` using a slighty faster approximation than doing a full division, safely handling negative values. |
| `shz::operator/` | [`shz_invf`](https://sh4zam.com/api/scalar/shz_invf/) | Takes the inverse of `x` using a slighty faster approximation than doing a full division, safely handling negative values. |

## Trigonometry aliases

| C++ | C function | Description |
| --- | --- | --- |
| `shz::sincosu16` | [`shz_sincosu16`](https://sh4zam.com/api/trig/shz_sincosu16/) | Returns sinf()/cosf() pairs for the given unsigned 16-bit angle in radians. |
| `shz::sincosf` | [`shz_sincosf`](https://sh4zam.com/api/trig/shz_sincosf/) | Returns sinf()/cosf() pairs for the given floating-point angle in radians. |
| `shz::sincosf_deg` | [`shz_sincosf_deg`](https://sh4zam.com/api/trig/shz_sincosf_deg/) | Returns sinf/cosf() pairs for the given floating-point angle in degrees. |
| `shz::sincos_tanf` | [`shz_sincos_tanf`](https://sh4zam.com/api/trig/shz_sincos_tanf/) | Returns tanf() from the given pre-computed `sincos` pair. |
| `shz::sincos_secf` | [`shz_sincos_secf`](https://sh4zam.com/api/trig/shz_sincos_secf/) | Returns the floating-point secant (1.0f / cosf(x)) from the given pre-computed `sincos` pair. |
| `shz::sincos_cscf` | [`shz_sincos_cscf`](https://sh4zam.com/api/trig/shz_sincos_cscf/) | Returns the floating-point cosecant (1.0f / sinf(x)) from the given pre-computed `sincos` pair. |
| `shz::sincos_cotf` | [`shz_sincos_cotf`](https://sh4zam.com/api/trig/shz_sincos_cotf/) | Returns the floating-point cotangent (1.0f / tanf(x)) from the given pre-computed `sincos` pair. |
| `shz::sinf` | [`shz_sinf`](https://sh4zam.com/api/trig/shz_sinf/) | One-off routine for returning only sinf() from an angle in radians. |
| `shz::sinf_deg` | [`shz_sinf_deg`](https://sh4zam.com/api/trig/shz_sinf_deg/) | One-off routine for returning only sinf() from an angle in degrees. |
| `shz::cosf` | [`shz_cosf`](https://sh4zam.com/api/trig/shz_cosf/) | One-off routine for returning only cosf() from an angle in radians. |
| `shz::cosf_deg` | [`shz_cosf_deg`](https://sh4zam.com/api/trig/shz_cosf_deg/) | One-off routine for returning only cosf() from an angle in degrees. |
| `shz::tanf` | [`shz_tanf`](https://sh4zam.com/api/trig/shz_tanf/) | One-off routine for returning only tanf() from an angle in radians. |
| `shz::tanf_deg` | [`shz_tanf_deg`](https://sh4zam.com/api/trig/shz_tanf_deg/) | One-off routine for returning only tanf() from an angle in degrees. |
| `shz::secf` | [`shz_secf`](https://sh4zam.com/api/trig/shz_secf/) | One-off routine for returning only secant (1 / cos(x)) from an angle in radians. |
| `shz::secf_deg` | [`shz_secf_deg`](https://sh4zam.com/api/trig/shz_secf_deg/) | One-off routine for returning only secant (1 / cos(x)) from an angle in degrees. |
| `shz::cscf` | [`shz_cscf`](https://sh4zam.com/api/trig/shz_cscf/) | One-off routine for returning only cosecant (1 / sin(x)) from an angle in radians. |
| `shz::cscf_deg` | [`shz_cscf_deg`](https://sh4zam.com/api/trig/shz_cscf_deg/) | One-off routine for returning only cosecant (1 / sin(x)) from an angle in degrees. |
| `shz::cotf` | [`shz_cotf`](https://sh4zam.com/api/trig/shz_cotf/) | One-off routine for returning only cotangent (1 / tan(x)) from an angle in radians. |
| `shz::cotf_deg` | [`shz_cotf_deg`](https://sh4zam.com/api/trig/shz_cotf_deg/) | One-off routine for returning only cotangent (1 / cot(x)) from an angle in degrees. |
| `shz::atanf_unit` | [`shz_atanf_unit`](https://sh4zam.com/api/trig/shz_atanf_unit/) | Fast arctangent approximation for unit values between `0.0f` and `1.0f`. |
| `shz::atanf_q1` | [`shz_atanf_q1`](https://sh4zam.com/api/trig/shz_atanf_q1/) | Fast arctangent approximation for values lying within the first quadrant (`>= 0.0f`). |
| `shz::atanf` | [`shz_atanf`](https://sh4zam.com/api/trig/shz_atanf/) | Fast arctangent approximation; equvalent to C's atanf(). |
| `shz::atan2f` | [`shz_atan2f`](https://sh4zam.com/api/trig/shz_atan2f/) | Computes arctangent of `y / x`, using the signs of arguments to determine correct quadtrant. Equivalent to C's atan2f(). |
| `shz::asinf` | [`shz_asinf`](https://sh4zam.com/api/trig/shz_asinf/) | Fast arcsine approximation; equivalent to C's asinf(). |
| `shz::acosf` | [`shz_acosf`](https://sh4zam.com/api/trig/shz_acosf/) | Fast arccosine approximation; equivalent to C's acosf(). |
| `shz::asecf` | [`shz_asecf`](https://sh4zam.com/api/trig/shz_asecf/) | Fast arcsecant/inverse secant approximation, taking units in radians. |
| `shz::acscf` | [`shz_acscf`](https://sh4zam.com/api/trig/shz_acscf/) | Fast arccosecant/inverse cosecant approximation; taking units in radians. |
| `shz::acotf` | [`shz_acotf`](https://sh4zam.com/api/trig/shz_acotf/) | Fast arccotangent/inverse cotangent approximation; taking units in radians. |
| `shz::sinhf` | [`shz_sinhf`](https://sh4zam.com/api/trig/shz_sinhf/) | Fast hyperbolic sine function. |
| `shz::coshf` | [`shz_coshf`](https://sh4zam.com/api/trig/shz_coshf/) | Fast hyperbolic cosine function. |
| `shz::tanhf` | [`shz_tanhf`](https://sh4zam.com/api/trig/shz_tanhf/) | Fast hyperbolic tangent function. |
| `shz::cschf` | [`shz_cschf`](https://sh4zam.com/api/trig/shz_cschf/) | Fast hyperbolic cosecant function. |
| `shz::sechf` | [`shz_sechf`](https://sh4zam.com/api/trig/shz_sechf/) | Fast hyperbolic secant function. |
| `shz::cothf` | [`shz_cothf`](https://sh4zam.com/api/trig/shz_cothf/) | Fast hyperbolic cotangent function. |
| `shz::asinhf` | [`shz_asinhf`](https://sh4zam.com/api/trig/shz_asinhf/) | Fast hyperbolic arcsine function. |
| `shz::acoshf` | [`shz_acoshf`](https://sh4zam.com/api/trig/shz_acoshf/) | Fast hyperbolic arccosine function. |
| `shz::atanhf` | [`shz_atanhf`](https://sh4zam.com/api/trig/shz_atanhf/) | Fast hyperbolic arctangent function. |
| `shz::acschf` | [`shz_acschf`](https://sh4zam.com/api/trig/shz_acschf/) | Fast hyperbolic arccosecant function. |
| `shz::asechf` | [`shz_asechf`](https://sh4zam.com/api/trig/shz_asechf/) | Fast hyperbolic arcsecant function. |
| `shz::acothf` | [`shz_acothf`](https://sh4zam.com/api/trig/shz_acothf/) | Fast hyperbolic arccotangent function. |

## Vector aliases

| C++ | C function | Description |
| --- | --- | --- |
| `shz::operator+` | [`shz_vec_add`](https://sh4zam.com/api/vector/shz_vec_add/) | C type-generic vector addition. |
| `shz::operator-` | [`shz_vec_sub`](https://sh4zam.com/api/vector/shz_vec_sub/) | C type-generic vector subtraction. |
| `shz::operator*` | [`shz_vec_mul`](https://sh4zam.com/api/vector/shz_vec_mul/) | C type-generic vector multiplication. |
| `shz::operator/` | [`shz_vec_div`](https://sh4zam.com/api/vector/shz_vec_div/) | C type-generic vector division. |
| `shz::operator*` | [`shz_vec_scale`](https://sh4zam.com/api/vector/shz_vec_scale/) | C type-generic vector scaling. |
| `shz::operator*` | [`shz_vec_scale`](https://sh4zam.com/api/vector/shz_vec_scale/) | C type-generic vector scaling. |
| `shz::operator/` | [`shz_vec_scale`](https://sh4zam.com/api/vector/shz_vec_scale/) | C type-generic vector scaling. |
| `shz::operator/` | [`shz_vec_div`](https://sh4zam.com/api/vector/shz_vec_div/) | C type-generic vector division. |

## Complex aliases

| C++ | C function | Description |
| --- | --- | --- |
| `shz::csqrtf` | [`shz_csqrtf`](https://sh4zam.com/api/complex/shz_csqrtf/) | Computes and returns the complex square root of `c`. |
| `shz::cpowf` | [`shz_cpowf`](https://sh4zam.com/api/complex/shz_cpowf/) | Raises the complex `base` to the complex `exp` power, returning a complex result. |
| `shz::cexpf` | [`shz_cexpf`](https://sh4zam.com/api/complex/shz_cexpf/) | Returns the complex base `e` exponential of `c`. |
| `shz::clogf` | [`shz_clogf`](https://sh4zam.com/api/complex/shz_clogf/) | Computes and returns the complex natural logarithm of `c`. |
| `shz::clog10f` | [`shz_clog10f`](https://sh4zam.com/api/complex/shz_clog10f/) | Computes and returns the complex base 10 logarithm of `c`. |
| `shz::operator+` | [`shz_caddf`](https://sh4zam.com/api/complex/shz_caddf/) | Adds two complex numbers together and returns the result. |
| `shz::operator-` | [`shz_csubf`](https://sh4zam.com/api/complex/shz_csubf/) | Subtracts `rhs` from `lhs` and returns the complex result. |
| `shz::operator*` | [`shz_cmulf`](https://sh4zam.com/api/complex/shz_cmulf/) | Multiplies two complex numbers together, returning the complex result. |
| `shz::operator*` | [`shz_cscalef`](https://sh4zam.com/api/complex/shz_cscalef/) | Scales both componets of the complex number, `c`, by the value, `v`, returning the result. |
| `shz::operator/` | [`shz_cdivf`](https://sh4zam.com/api/complex/shz_cdivf/) | Divides `lhs` by `rhs`, returning the complex result. |
| `shz::operator/` | [`shz_cscalef`](https://sh4zam.com/api/complex/shz_cscalef/) | Scales both componets of the complex number, `c`, by the value, `v`, returning the result. |
| `shz::operator==` | [`shz_cequalf`](https://sh4zam.com/api/complex/shz_cequalf/) | Checks for equality between two complex numbers with either an absolute or relative tolerance. |
| `shz::cinitf` | [`shz_cinitf`](https://sh4zam.com/api/complex/shz_cinitf/) | Returns a complex number which has been initialized to contain the given component values. |
| `shz::cpolarf` | [`shz_cpolarf`](https://sh4zam.com/api/complex/shz_cpolarf/) | Returns a complex number with a magnitude of `r`, and a phase angle of `theta` (in radians). |
| `shz::cequalf` | [`shz_cequalf`](https://sh4zam.com/api/complex/shz_cequalf/) | Checks for equality between two complex numbers with either an absolute or relative tolerance. |
| `shz::crealf` | [`shz_crealf`](https://sh4zam.com/api/complex/shz_crealf/) | Returns the real component of a complex number. |
| `shz::cimagf` | [`shz_cimagf`](https://sh4zam.com/api/complex/shz_cimagf/) | Returns the imaginary component of a complex number. |
| `shz::caddf` | [`shz_caddf`](https://sh4zam.com/api/complex/shz_caddf/) | Adds two complex numbers together and returns the result. |
| `shz::csubf` | [`shz_csubf`](https://sh4zam.com/api/complex/shz_csubf/) | Subtracts `rhs` from `lhs` and returns the complex result. |
| `shz::cmulf` | [`shz_cmulf`](https://sh4zam.com/api/complex/shz_cmulf/) | Multiplies two complex numbers together, returning the complex result. |
| `shz::cdivf` | [`shz_cdivf`](https://sh4zam.com/api/complex/shz_cdivf/) | Divides `lhs` by `rhs`, returning the complex result. |
| `shz::cscalef` | [`shz_cscalef`](https://sh4zam.com/api/complex/shz_cscalef/) | Scales both componets of the complex number, `c`, by the value, `v`, returning the result. |
| `shz::crecipf` | [`shz_crecipf`](https://sh4zam.com/api/complex/shz_crecipf/) | Returns the multiplicative inverse or reciprocal of the complex number, `c`. |
| `shz::cabsf` | [`shz_cabsf`](https://sh4zam.com/api/complex/shz_cabsf/) | Returns the absolute value (or magnitude) of the complex number, `c`. |
| `shz::inv_cabsf` | [`shz_inv_cabsf`](https://sh4zam.com/api/complex/shz_inv_cabsf/) | Returns the inverse of the absolute value (or inverse of the magnitude) of the complex number, `c`. |
| `shz::cnormf` | [`shz_cnormf`](https://sh4zam.com/api/complex/shz_cnormf/) | Returns the squared magnitude of the complex number, `c`. |
| `shz::cargf` | [`shz_cargf`](https://sh4zam.com/api/complex/shz_cargf/) | Returns the phase angle of the complex number, `c`. |
| `shz::conjf` | [`shz_conjf`](https://sh4zam.com/api/complex/shz_conjf/) | Returns the complex conjugate of `c`. |
| `shz::cprojf` | [`shz_cprojf`](https://sh4zam.com/api/complex/shz_cprojf/) | Calculates the projection of the complex number, `c`, onto the Riemann sphere. |
| `shz::csinf` | [`shz_csinf`](https://sh4zam.com/api/complex/shz_csinf/) | Calculates and returns the complex sine of `c`. |
| `shz::ccosf` | [`shz_ccosf`](https://sh4zam.com/api/complex/shz_ccosf/) | Calculates and returns the complex cosine of `c`. |
| `shz::ctanf` | [`shz_ctanf`](https://sh4zam.com/api/complex/shz_ctanf/) | Calculates and returns the complex tangent of `c`. |
| `shz::ccscf` | [`shz_ccscf`](https://sh4zam.com/api/complex/shz_ccscf/) | Calculates and returns the complex cosecant of `c`. |
| `shz::csecf` | [`shz_csecf`](https://sh4zam.com/api/complex/shz_csecf/) | Calculates and returns the complex secant of `c`. |
| `shz::ccotf` | [`shz_ccotf`](https://sh4zam.com/api/complex/shz_ccotf/) | Calculates and returns the complex cotangent of `c`. |
| `shz::casinf` | [`shz_casinf`](https://sh4zam.com/api/complex/shz_casinf/) | Calculates and returns the complex arcsine of `c`. |
| `shz::cacosf` | [`shz_cacosf`](https://sh4zam.com/api/complex/shz_cacosf/) | Calculates and returns the complex arccosine of `c`. |
| `shz::catanf` | [`shz_catanf`](https://sh4zam.com/api/complex/shz_catanf/) | Calculates and returns the complex arctangent of `c`. |
| `shz::cacscf` | [`shz_cacscf`](https://sh4zam.com/api/complex/shz_cacscf/) | Calculates and returns the complex arccosecant of `c`. |
| `shz::casecf` | [`shz_casecf`](https://sh4zam.com/api/complex/shz_casecf/) | Calculates and returns the complex arcsecant of `c`. |
| `shz::cacotf` | [`shz_cacotf`](https://sh4zam.com/api/complex/shz_cacotf/) | Calculates and returns the complex arccotangent of `c`. |
| `shz::csinhf` | [`shz_csinhf`](https://sh4zam.com/api/complex/shz_csinhf/) | Calculates and returns the complex hyperbolic sine of `c`. |
| `shz::ccoshf` | [`shz_ccoshf`](https://sh4zam.com/api/complex/shz_ccoshf/) | Calculates and returns the complex hyperbolic cosine of `c`. |
| `shz::ctanhf` | [`shz_ctanhf`](https://sh4zam.com/api/complex/shz_ctanhf/) | Calculates and returns the complex hyperbolic tangent of `c`. |
| `shz::ccschf` | [`shz_ccschf`](https://sh4zam.com/api/complex/shz_ccschf/) | Calculates and returns the complex hyperbolic cosecant of `c`. |
| `shz::csechf` | [`shz_csechf`](https://sh4zam.com/api/complex/shz_csechf/) | Calculates and returns the complex hyperbolic secant of `c`. |
| `shz::ccothf` | [`shz_ccothf`](https://sh4zam.com/api/complex/shz_ccothf/) | Calculates and returns the complex hyperbolic cotangent of `c`. |
| `shz::casinhf` | [`shz_casinhf`](https://sh4zam.com/api/complex/shz_casinhf/) | Calculates and returns the complex hyperbolic arcsine of `c`. |
| `shz::cacoshf` | [`shz_cacoshf`](https://sh4zam.com/api/complex/shz_cacoshf/) | Calculates and returns the complex hyperbolic arccosine of `c`. |
| `shz::catanhf` | [`shz_catanhf`](https://sh4zam.com/api/complex/shz_catanhf/) | Calculates and returns the complex hyperbolic arctangent of `c`. |
| `shz::cacschf` | [`shz_cacschf`](https://sh4zam.com/api/complex/shz_cacschf/) | Calculates and returns the complex hyperbolic arccosecant of `c`. |
| `shz::casechf` | [`shz_casechf`](https://sh4zam.com/api/complex/shz_casechf/) | Calculates and returns the complex hyperbolic arcsecant of `c`. |
| `shz::cacothf` | [`shz_cacothf`](https://sh4zam.com/api/complex/shz_cacothf/) | Calculates and returns the complex hyperbolic arccotangent of `c`. |
| `shz::fft` | [`shz_fft`](https://sh4zam.com/api/complex/shz_fft/) | Fast Fourier Transform. |

## Memory aliases

| C++ | C function | Description |
| --- | --- | --- |
| `shz::dcache_alloc_line` | [`shz_dcache_alloc_line`](https://sh4zam.com/api/memory/shz_dcache_alloc_line/) | Intrinsic around the SH4 `MOVCA.L` instruction. |
| `shz::memcpy` | [`shz_memcpy`](https://sh4zam.com/api/memory/shz_memcpy/) | Generic drop-in fast memcpy() replacement. |
| `shz::memcpy1` | [`shz_memcpy1`](https://sh4zam.com/api/memory/shz_memcpy1/) | Copies an unaligned buffer to another one byte at a time. |
| `shz::memcpy2` | [`shz_memcpy2`](https://sh4zam.com/api/memory/shz_memcpy2/) | Copies from one 2-byte aligned buffer to another two bytes at a time. |
| `shz::memcpy4` | [`shz_memcpy4`](https://sh4zam.com/api/memory/shz_memcpy4/) | Copies a from one 4-byte aligned buffer to another 4 bytes at a time. |
| `shz::memcpy8` | [`shz_memcpy8`](https://sh4zam.com/api/memory/shz_memcpy8/) | Copies a from one 8-byte aligned buffer to another 8 bytes at a time. |
| `shz::memset8` | [`shz_memset8`](https://sh4zam.com/api/memory/shz_memset8/) | Assigns the given 8-byte `value` to the `bytes` in `dst`. |
| `shz::memcpy32` | [`shz_memcpy32`](https://sh4zam.com/api/memory/shz_memcpy32/) | Copies `bytes` from the `src` to the `dst` buffer in 32-byte chunks. |
| `shz::memcpy64` | [`shz_memcpy64`](https://sh4zam.com/api/memory/shz_memcpy64/) | Specialized memcpy() variant for copying multiples of 64-bytes. |
| `shz::memcpy2_8` | [`shz_memcpy2_8`](https://sh4zam.com/api/memory/shz_memcpy2_8/) | Copies 8 shorts from `src` to `dst`. |
| `shz::memcpy2_16` | [`shz_memcpy2_16`](https://sh4zam.com/api/memory/shz_memcpy2_16/) | Copies 16 shorts from `src` to `dst`. |
| `shz::memset2_16` | [`shz_memset2_16`](https://sh4zam.com/api/memory/shz_memset2_16/) | Sets the values of the 16 shorts pointed to by `dst` to the given `value`. |
| `shz::memcpy4_16` | [`shz_memcpy4_16`](https://sh4zam.com/api/memory/shz_memcpy4_16/) | Copies 16 4-byte, long values from `src` to `dst`. |
| `shz::memswap32_1` | [`shz_memswap32_1`](https://sh4zam.com/api/memory/shz_memswap32_1/) | Swaps the values within the given 32-byte buffers. |
| `shz::memswap32_1_xmtrx` | [`shz_memswap32_1_xmtrx`](https://sh4zam.com/api/memory/shz_memswap32_1_xmtrx/) | Swaps the values within the given 32-byte buffers, using XMTRX. |
| `shz::sq_memcpy32` | [`shz_sq_memcpy32`](https://sh4zam.com/api/memory/shz_sq_memcpy32/) | Copies `bytes` from `src` to `dst` in 32-byte chunks, using the Store Queues. |
| `shz::sq_memcpy32_xmtrx` | [`shz_sq_memcpy32_xmtrx`](https://sh4zam.com/api/memory/shz_sq_memcpy32_xmtrx/) | Copies `bytes` from `src` to `dst` in 32-byte chunks, using the Store Queues and XMTRX. |
| `shz::sq_memcpy32_1` | [`shz_sq_memcpy32_1`](https://sh4zam.com/api/memory/shz_sq_memcpy32_1/) | Copies `src` to `dst` in a single 32-byte transaction using the Store Queues. |
| `shz::sq_memcpy32_1_xmtrx` | [`shz_sq_memcpy32_1_xmtrx`](https://sh4zam.com/api/memory/shz_sq_memcpy32_1_xmtrx/) | Copies `src` to `dst` in a single 32-byte transaction using the Store Queues and XMTRX. |
| `shz::memmove` | [`shz_memmove`](https://sh4zam.com/api/memory/shz_memmove/) | Generic drop-in fast memmove() replacement. |
| `shz::memcpy128` | [`shz_memcpy128`](https://sh4zam.com/api/memory/shz_memcpy128/) | Specialized memcpy() variant for copying multiples of 128 bytes. |

## Constants

| C++ | Definition | Description |
| --- | --- | --- |
| `shz::fipr_max_error` | `constexpr float fipr_max_error = 0.1f;` |  |
| `shz::pi_f` | `constexpr float pi_f = SHZ_F_PI;` | Floating-point constant approximation for Pi. |
| `shz::tau_f` | `constexpr float tau_f = SHZ_F_TAU;` | Floating-point constant approximation for Pi\*2. |
| `shz::pi_f_2` | `constexpr float pi_f_2 = SHZ_F_PI_2;` | Floating-point constant approximation for Pi/2. |
| `shz::pi_f_4` | `constexpr float pi_f_4 = SHZ_F_PI_4;` | Floating-point constant approximation for Pi/4. |
| `shz::fsca_rad_factor` | `constexpr float fsca_rad_factor = SHZ_FSCA_RAD_FACTOR;` | Scaling factor used to scale the input to FSCA from radians. |
| `shz::fsca_deg_factor` | `constexpr float fsca_deg_factor = SHZ_FSCA_DEG_FACTOR;` | Scaling factor used to scale the input to FSCA from degrees. |
