atan
Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-10
println(atan(0.0)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0) - PI / 4).absoluteValue < epsilon is ${(atan(1.0) - PI / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon is ${(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.123)) - 0.123).absoluteValue < epsilon is ${(atan(tan(0.123)) - 0.123).absoluteValue < epsilon}") // true
// special cases
println(atan(Double.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-6f
println(atan(0.0f)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon is ${(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon is ${(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon is ${(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon}") // true
// special cases
println(atan(Float.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-10
println(atan(0.0)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0) - PI / 4).absoluteValue < epsilon is ${(atan(1.0) - PI / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon is ${(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.123)) - 0.123).absoluteValue < epsilon is ${(atan(tan(0.123)) - 0.123).absoluteValue < epsilon}") // true
// special cases
println(atan(Double.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-6f
println(atan(0.0f)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon is ${(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon is ${(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon is ${(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon}") // true
// special cases
println(atan(Float.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-10
println(atan(0.0)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0) - PI / 4).absoluteValue < epsilon is ${(atan(1.0) - PI / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon is ${(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.123)) - 0.123).absoluteValue < epsilon is ${(atan(tan(0.123)) - 0.123).absoluteValue < epsilon}") // true
// special cases
println(atan(Double.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.2Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-6f
println(atan(0.0f)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon is ${(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon is ${(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon is ${(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon}") // true
// special cases
println(atan(Float.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.3Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-10
println(atan(0.0)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0) - PI / 4).absoluteValue < epsilon is ${(atan(1.0) - PI / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon is ${(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.123)) - 0.123).absoluteValue < epsilon is ${(atan(tan(0.123)) - 0.123).absoluteValue < epsilon}") // true
// special cases
println(atan(Double.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.3Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-6f
println(atan(0.0f)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon is ${(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon is ${(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon is ${(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon}") // true
// special cases
println(atan(Float.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-10
println(atan(0.0)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0) - PI / 4).absoluteValue < epsilon is ${(atan(1.0) - PI / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon is ${(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.123)) - 0.123).absoluteValue < epsilon is ${(atan(tan(0.123)) - 0.123).absoluteValue < epsilon}") // true
// special cases
println(atan(Double.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-6f
println(atan(0.0f)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon is ${(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon is ${(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon is ${(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon}") // true
// special cases
println(atan(Float.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-10
println(atan(0.0)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0) - PI / 4).absoluteValue < epsilon is ${(atan(1.0) - PI / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon is ${(atan(-1.0) - (-PI / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.123)) - 0.123).absoluteValue < epsilon is ${(atan(tan(0.123)) - 0.123).absoluteValue < epsilon}") // true
// special cases
println(atan(Double.NaN)) // NaN
//sampleEnd
}Computes the arc tangent of the value x; the returned value is an angle in the range from -PI/2 to PI/2 radians.
Special cases:
atan(NaN)isNaN
Since Kotlin
1.8Samples
import kotlin.math.*
import kotlin.test.*
fun main() {
//sampleStart
val epsilon = 1e-6f
println(atan(0.0f)) // 0.0
// Results may not be exact, so we're only checking that they are within epsilon from the expected value
// atan(1.0) = π/4
println("(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon is ${(atan(1.0f) - PI.toFloat() / 4).absoluteValue < epsilon}") // true
// atan(-1.0) = -π/4
println("(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon is ${(atan(-1.0f) - (-PI.toFloat() / 4)).absoluteValue < epsilon}") // true
// atan(tan(x)) = x
println("(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon is ${(atan(tan(0.25f)) - 0.25f).absoluteValue < epsilon}") // true
// special cases
println(atan(Float.NaN)) // NaN
//sampleEnd
}