---
title: "atan2"
subtitle: "Function in std::math"
excerpt: "Compute the four quadrant arctangent of Y and X."
layout: manual
---

Compute the four quadrant arctangent of Y and X.

```kcl
atan2(
  y: number(Length),
  x: number(Length),
): number(rad)
```



### Arguments

| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `y` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | A number. | Yes |
| `x` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | A number. | Yes |

### Returns

[`number(rad)`](/docs/kcl-std/types/std-types-number) - A number.


### Examples

```kcl
sketch001 = startSketchOn(XZ)
  |> startProfile(at = [0, 0])
  |> angledLine(
    angle = atan2(y = 1.25, x = 2),
    length = 20,
  )
  |> yLine(endAbsolute = 0)
  |> close()

extrude001 = extrude(sketch001, length = 5)
```

![Rendered example of atan2 0](data:image/png;base64,[encoded data, 81052 characters])


