Platform and version requirements: Kotlin 1.2
Mathematical functions and constants.
The functions include trigonometric, hyperbolic, exponentiation and power, logarithmic, rounding, sign and absolute value.
const val E: Double Base of the natural logarithms, approximately 2.71828. | |
const val PI: Double Ratio of the circumference of a circle to its diameter, approximately 3.14159. | |
val Double.absoluteValue: Double val Float.absoluteValue: Float val Int.absoluteValue: Int val Long.absoluteValue: Long Returns the absolute value of this value. | |
val Double.sign: Double val Float.sign: Float val Int.sign: Int val Long.sign: Int Returns the sign of this value: | |
val Double.ulp: Double Returns the ulp (unit in the last place) of this value. val Float.ulp: Float Returns the ulp of this value. |
fun Double.IEEErem(divisor: Double): Double fun Float.IEEErem(divisor: Float): Float Computes the remainder of division of this value by the divisor value according to the IEEE 754 standard. | |
fun abs(x: Double): Double fun abs(x: Float): Float Returns the absolute value of the given value x. fun abs(n: Int): Int fun abs(n: Long): Long Returns the absolute value of the given value n. | |
fun acos(x: Double): Double fun acos(x: Float): Float Computes the arc cosine of the value x; the returned value is an angle in the range from | |
fun acosh(x: Double): Double fun acosh(x: Float): Float Computes the inverse hyperbolic cosine of the value x. | |
fun asin(x: Double): Double fun asin(x: Float): Float Computes the arc sine of the value x; the returned value is an angle in the range from | |
fun asinh(x: Double): Double fun asinh(x: Float): Float Computes the inverse hyperbolic sine of the value x. | |
fun atan(x: Double): Double fun atan(x: Float): Float Computes the arc tangent of the value x; the returned value is an angle in the range from | |
fun atan2(y: Double, x: Double): Double fun atan2(y: Float, x: Float): Float Returns the angle | |
fun atanh(x: Double): Double fun atanh(x: Float): Float Computes the inverse hyperbolic tangent of the value x. | |
fun ceil(x: Double): Double fun ceil(x: Float): Float Rounds the given value x to an integer towards positive infinity. | |
fun cos(x: Double): Double fun cos(x: Float): Float Computes the cosine of the angle x given in radians. | |
fun cosh(x: Double): Double fun cosh(x: Float): Float Computes the hyperbolic cosine of the value x. | |
fun exp(x: Double): Double fun exp(x: Float): Float Computes Euler's number | |
fun expm1(x: Double): Double fun expm1(x: Float): Float Computes | |
fun floor(x: Double): Double fun floor(x: Float): Float Rounds the given value x to an integer towards negative infinity. | |
fun hypot(x: Double, y: Double): Double fun hypot(x: Float, y: Float): Float Computes | |
fun ln(x: Double): Double fun ln(x: Float): Float Computes the natural logarithm (base | |
fun ln1p(x: Double): Double Computes fun ln1p(x: Float): Float Computes | |
fun log(x: Double, base: Double): Double fun log(x: Float, base: Float): Float | |
fun log10(x: Double): Double fun log10(x: Float): Float Computes the common logarithm (base 10) of the value x. | |
fun log2(x: Double): Double fun log2(x: Float): Float Computes the binary logarithm (base 2) of the value x. | |
fun max(a: Double, b: Double): Double fun max(a: Float, b: Float): Float fun max(a: Int, b: Int): Int fun max(a: Long, b: Long): Long Returns the greater of two values. | |
fun min(a: Double, b: Double): Double fun min(a: Float, b: Float): Float fun min(a: Int, b: Int): Int fun min(a: Long, b: Long): Long Returns the smaller of two values. | |
fun Double.nextDown(): Double Returns the Double value nearest to this value in direction of negative infinity. fun Float.nextDown(): Float Returns the Float value nearest to this value in direction of negative infinity. | |
fun Double.nextTowards(to: Double): Double Returns the Double value nearest to this value in direction from this value towards the value to. fun Float.nextTowards(to: Float): Float Returns the Float value nearest to this value in direction from this value towards the value to. | |
fun Double.nextUp(): Double Returns the Double value nearest to this value in direction of positive infinity. fun Float.nextUp(): Float Returns the Float value nearest to this value in direction of positive infinity. | |
fun Double.pow(x: Double): Double fun Float.pow(x: Float): Float Raises this value to the power x. fun Double.pow(n: Int): Double fun Float.pow(n: Int): Float Raises this value to the integer power n. | |
fun round(x: Double): Double fun round(x: Float): Float Rounds the given value x towards the closest integer with ties rounded towards even integer. | |
fun Double.roundToInt(): Int Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity. fun Float.roundToInt(): Int Rounds this Float value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity. | |
fun Double.roundToLong(): Long Rounds this Double value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity. fun Float.roundToLong(): Long Rounds this Float value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity. | |
fun sign(x: Double): Double fun sign(x: Float): Float Returns the sign of the given value x: | |
fun sin(x: Double): Double fun sin(x: Float): Float Computes the sine of the angle x given in radians. | |
fun sinh(x: Double): Double fun sinh(x: Float): Float Computes the hyperbolic sine of the value x. | |
fun sqrt(x: Double): Double fun sqrt(x: Float): Float Computes the positive square root of the value x. | |
fun tan(x: Double): Double fun tan(x: Float): Float Computes the tangent of the angle x given in radians. | |
fun tanh(x: Double): Double fun tanh(x: Float): Float Computes the hyperbolic tangent of the value x. | |
fun truncate(x: Double): Double fun truncate(x: Float): Float Rounds the given value x to an integer towards zero. | |
fun Double.withSign(sign: Double): Double fun Double.withSign(sign: Int): Double fun Float.withSign(sign: Float): Float fun Float.withSign(sign: Int): Float Returns this value with the sign bit same as of the sign value. |
© 2010–2018 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.math/index.html