# Scala - Math atan() Method

The Scala Math atan() method returns arc tangent of a value. The return value will be in the range -𝜋/2 through 𝜋/2. In special cases it returns the following:

• If the argument is NaN, then the result is NaN.

Note: atan() is the inverse of tan().

### Syntax

```def atan(x: Double): Double = scala.lang.Math.atan(x)
```

### Parameters

 `x` Specify the value.

### Return Value

Returns the arc tangent of the value.

NA.

### Example:

In the example below, atan() method is used to find out the arc tangent of a given value.

```import scala.math._

object MainObject {
def main(args: Array[String]) {
println(s"atan(-1) = \${atan(-1)}");
println(s"atan(0.5) = \${atan(0.5)}");
println(s"atan(0) = \${atan(0)}");
println(s"atan(0.5) = \${atan(0.5)}");
println(s"atan(1) = \${atan(1)}");
println(s"atan(Double.NaN) = \${atan(Double.NaN)}");
println(s"atan(2) = \${atan(2)}");
println("atan(Double.PositiveInfinity) = "
+ atan(Double.PositiveInfinity));
}
}
```

The output of the above code will be:

```atan(-1) = -0.7853981633974483
atan(0.5) = 0.4636476090008061
atan(0) = 0.0
atan(0.5) = 0.4636476090008061
atan(1) = 0.7853981633974483
atan(Double.NaN) = NaN
atan(2) = 1.1071487177940904
atan(Double.PositiveInfinity) = 1.5707963267948966
```

❮ Scala - Math Methods

5