addaptic

Reference Trigonometry

lz_arctangent2

The angle of the point (x, y), with y first, as C's atan2 takes them.

long lz_arctangent2( CLZNumber* leftOperand, CLZNumber* rightOperand, CLZNumber* targetNumber = nullptr );

The angle of the point from the positive x-axis, in (−π, π], or (−180°, 180°], correctly rounded in the thread's unit. The left operand is y and the right is x, as C's atan2( y, x ) takes them.

On the axes it answers as std::atan2 does for +0: nought along the positive x-axis, π along the negative one, and ±π/2 on the y-axis. The origin answers nought. An infinity or a not-a-number in either answers a not-a-number, and a missing operand is refused, kFailed. A right operand in another base is brought into the left's exactly.

Examples

CallAnswer
lz_arctangent2( 1, 1 )0.785398163397448309615660845819875721
lz_arctangent2( 1, −1 ) degrees135
lz_arctangent2( −1, −1 ) degrees−135
lz_arctangent2( 0, −1 )3.141592653589793238462643383279502884
lz_arctangent2( 0, 0 )0

Each answer is what Addaptic printed for the call, in radians, at 36 places unless a setting is shown.

Returns

kNoError (0) when the answer is written. Otherwise an error code, with the answer flagged infinite or not-a-number; see Errors and flags.

See also

  • lz_arctangent The angle whose tangent is the number.
  • lzc_arg The argument of a complex number, its angle, a real answer in the thread's angle unit.