ArcTan2

riscv_status riscv_atan2_f16(float16_t y, float16_t x, float16_t *result)
riscv_status riscv_atan2_f32(float32_t y, float32_t x, float32_t *result)
riscv_status riscv_atan2_q15(q15_t y, q15_t x, q15_t *result)
riscv_status riscv_atan2_q31(q31_t y, q31_t x, q31_t *result)
group atan2

Computing Arc tangent only using the ratio y/x is not enough to determine the angle since there is an indeterminacy. Opposite quadrants are giving the same ratio.

ArcTan2 is not using y/x to compute the angle but y and x and use the sign of y and x to determine the quadrant.

Functions

riscv_status riscv_atan2_f16(float16_t y, float16_t x, float16_t *result)

Arc Tangent of y/x using sign of y and x to get right quadrant.

Arc tangent in radian of y/x using sign of x and y to determine right quadrant.

Compute the Arc tangent of y/x:

The sign of y and x are used to determine the right quadrant and compute the right angle.

Parameters
  • y[in] y coordinate

  • x[in] x coordinate

  • result[out] Result

Returns

error status.

riscv_status riscv_atan2_f32(float32_t y, float32_t x, float32_t *result)

Arc Tangent of y/x using sign of y and x to get right quadrant.

Arc tangent in radian of y/x using sign of x and y to determine right quadrant.

Compute the Arc tangent of y/x:

The sign of y and x are used to determine the right quadrant and compute the right angle.

Parameters
  • y[in] y coordinate

  • x[in] x coordinate

  • result[out] Result

Returns

error status.

riscv_status riscv_atan2_q15(q15_t y, q15_t x, q15_t *result)

Arc Tangent of y/x using sign of y and x to get right quadrant.

Arc tangent in radian of y/x using sign of x and y to determine right quadrant.

Compute the Arc tangent of y/x:

The sign of y and x are used to determine the right quadrant and compute the right angle.

Parameters
  • y[in] y coordinate

  • x[in] x coordinate

  • result[out] Result in Q2.13

Returns

error status.

riscv_status riscv_atan2_q31(q31_t y, q31_t x, q31_t *result)

Arc Tangent of y/x using sign of y and x to get right quadrant.

Arc tangent in radian of y/x using sign of x and y to determine right quadrant.

Compute the Arc tangent of y/x:

The sign of y and x are used to determine the right quadrant and compute the right angle.

Parameters
  • y[in] y coordinate

  • x[in] x coordinate

  • result[out] Result in Q2.29

Returns

error status.