# Documentation/Calc Functions/ATAN2

From The Document Foundation Wiki

TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate

## Function name:

ATAN2

## Category:

Mathematical

## Summary:

Returns the angle (in radians) between the x-axis and a line from the origin to the point (Number X | Number Y). This function calculates the principal value.

## Syntax:

ATAN2(**Number X**; **Number Y**)

## Returns:

ATAN2 returns the angle (in radians) between the x-axis and a line from the origin to the point ( **Number X** | **Number Y**). The angle returned is between -PI and PI, i.e. [-π,π].

## Arguments:

**Number X** is the value of the x coordinate.

**Number Y** is the value of the y coordinate.

**Number X** and **Number Y** both can be 0 upon which function returns 0.

Programming languages have usually the opposite order of arguments for their atan2() function.

## Additional details:

- To return the angle in degrees, use the DEGREES function.
- If the function returns a positive angle it represents a counterclockwise angle from the x-axis while a negative result represents a clockwise angle.

## Examples:

Formula | Description | Returns |
---|---|---|

=ATAN2(-5;9) | The angle (in radians) between the x-axis and a line from the origin to the point having X = -5 and Y = 9. | 2.07789 (radians) |

=DEGREES(ATAN2(12.3;12.3)) | The angle (in radians) between the x-axis and a line from the origin to the point having X = 12.3 and Y = 12.3. To get the angle in degrees apply the DEGREES function to the result. The tangent of 45 degrees is 1. | 45° (degrees) |

=ATAN2(0;0) | The angle (in radians) between the x-axis and a line from the origin to the point having X = 0 and Y = 0. | 0 (radians) |

=ATAN2(-5;-3)*180/PI() | The angle (in radians) between the x-axis and a line from the origin to the point having X = -5 and Y = -3. Further, converting angle in radians to degrees by multiplying by 180/PI(). | -149.036243467926° (degrees) |

=DEGREES(ATAN2(-8;5)) | The angle (in radians) between the x-axis and a line from the origin to the point having X = -8 and Y = 5. The function can be used in converting cartesian coordinates to polar coordinates. See the Fig. below | 147.994616791916° (degrees) |

## Related LibreOffice functions:

## ODF standard:

## Equivalent Excel functions:

ATAN2