atan()

Anonymous contributor's avatar
Anonymous contributor
Anonymous contributor's avatar
Anonymous contributor
Published Oct 19, 2023
Contribute to Docs

The atan() method in Kotlin’s math class is used to calculate the arc tangent of a value. It returns the value of the angle in the range from -PI/2 to PI/2 radians.

Syntax

atan(x)
  • x: The number for which the arc tangent is to be calculated.

The atan() method returns a value of type double or float depending also on the type of the input respectively. If the argument passed is NaN, the method will return NaN.

Example

This example shows how to use the atan() method to calculate the arc tangent of 90.0:

import kotlin.math.*
fun main(){
println(atan(90.0))
}

The output of this code will be:

1.5596856728972892

All contributors

Contribute to Docs

Learn Kotlin on Codecademy