shz_atan2f
SHZ_INLINE float shz_atan2f(float y, float x) SHZ_NOEXCEPT;Computes arctangent of y / x, using the signs of arguments to determine correct quadrant.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
y | float | |
x | float |
Returns
Section titled “Returns”float
Details
Section titled “Details”Equivalent to C's atan2f().
Returns the angle of the vector (x, y) in radians, within [-pi, pi].
Accuracy: |shz_atan2f(y, x) - atan2(y, x)| <= 1.4e-5 radians with the default SHZ_ATAN2F_TERMS of 5 (#SHZ_ATAN2F_ERROR_MAX gives the bound for the configured value), for finite arguments with 2e-18 <= |x| + |y| <= 5e17. On the four axes the result is within 6e-7 of 0, +-pi/2, or pi for every setting.
shz_atan2f(+-0, +-0)returns0. The result takes the sign ofy, where a zeroyof either sign counts as positive:shz_atan2f(-0.0f, -1.0f)is+piwhere C's atan2f() gives-pi.
Availability
Section titled “Availability”- C++ equivalent:
shz::atan2f - Type-generic form: none
- Back-ends: SH4: shared C implementation · SW: portable C · SPU: shared C implementation
- Defined in:
sh4zam/shz_trig.h:250 - Module: Trigonometry, section "Inverse Functions"