Skip to contents

Element-wise atan2 operation: the angle (in radians) between the positive x-axis and the point (x, y).

The operands are named y and x, in that order, after base::atan2(), rather than lhs / rhs.

Usage

prim_atan2(y, x)

Arguments

y, x

(arrayish)
Ordinate and abscissa of the point, of the same shape. Can be any float data type. y and x must have the same data type. An R value among them assumes the data type of the others when it is in its data type category, and its default data type when none of them has one.

Value

(arrayish)
Has the inputs' shape and data type.

Implemented Rules

  • stablehlo

  • reverse

StableHLO

Lowers to hlo_atan2(), specified under atan2.

See also

Examples

# two R values: both take an R double's default data type
prim_atan2(1, 1)
#> AnvlArray
#>  0.7854
#> [ CPUf32{} ] 

# the R value is built at the array's data type instead
prim_atan2(1, nv_scalar(1, "f64"))
#> AnvlArray
#>  0.7854
#> [ CPUf64{} ]